I have some text in my application that says in case you need extra help, please email us and here is the email address, blah, blah.
But I want them to be able to click the email link and have their email client open. Is that possible? Or is that bad practice?
If it is reasonable practice, how can it be done?
In the message, select the text or picture that you want to display as the link. On the Insert tab, click Link or Hyperlink. Under Link to, click E-mail Address. Either type the email address that you want in the E-mail address box, or select an email address in the Recently used e-mail addresses list.
Select the text or picture that you want to display as a hyperlink. Press Ctrl+K. You can also right-click the text or picture and click Link on the shortcut menu. In the Insert Hyperlink box, type or paste your link in the Address box.
This is a very reasonable request and the Linkify
class will turn every email address into an appropriate link for you. Simply add the autoLink
attribute to your XML:
<TextView ... android:autoLink="email" />
You can make your text clickable by using setOnClickListener on the text
textView.setOnClickListener(new View.OnClickListener());
You can open the email client by creating a new Intent with the ACTION_SEND. Settype, the email address and subject like this:
Intent emailintent = new Intent(android.content.Intent.ACTION_SEND); emailintent.setType("plain/text"); emailintent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] {"[email protected]" }); emailintent.putExtra(android.content.Intent.EXTRA_SUBJECT, ""); emailintent.putExtra(android.content.Intent.EXTRA_TEXT,""); startActivity(Intent.createChooser(emailintent, "Send mail..."));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With