Here's what I do to display a dialog with an email link that opens the
default mail app and a web link for support that opens the default
browser:
private void showHelpAbout() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getResources().getString(R.string.aboutApp));
builder.setCancelable(false);
builder.setPositiveButton(getResources().getString(R.string.ok),
confirmListener);
final TextView message = new TextView(EntryPoint.this);
message.setLinksClickable(true);
message.setMovementMethod(LinkMovementMethod.getInstance());
StringBuilder msg = new StringBuilder();
msg.append(getText(R.string.app_name));
msg.append(" ");
msg.append(getText(R.string.appVersion));
msg.append(getText(R.string.supportEmail));
msg.append(getText(R.string.supportLink));
final SpannableString string = new SpannableString(msg);
Linkify.addLinks(string, Linkify.EMAIL_ADDRESSES |
Linkify.WEB_URLS);
message.setText(string);
message.setPadding(5, 5, 5, 5);
builder.setView(message);
builder.show();
}
where:
EntryPoint is my Activity/Context and string resource IDs are defined
strings. I hope its self explanatory enough to figure out how to do
it.
Cheers,
- C
On May 3, 3:42 pm, dashman <[email protected]> wrote:
> I'd like to display an alert dialog text with an url
> to an email address.
>
> user can tap on the link and then mail program
> opens.
>
> how can i do this.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en