Loading

Sunday, August 15, 2010

How to add a linkable text in Dialog

It's a example to add a linkable text in a dialog, using Linkify.

linkable text in Dialog

 private void openOptionsMySiteDialog()
{

final SpannableString stMyWeb = new SpannableString("http://android-er.blogspot.com/");
Linkify.addLinks(stMyWeb, Linkify.ALL);

final AlertDialog aboutDialog = new AlertDialog.Builder(MyActivity.this)
.setMessage(stMyWeb)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}})
.create();

aboutDialog.show();

((TextView)aboutDialog.findViewById(android.R.id.message))
.setMovementMethod(LinkMovementMethod.getInstance());

}

SHARE TWEET

Thank you for reading this article How to add a linkable text in Dialog With URL https://x-tutorials.blogspot.com/2010/08/how-to-add-linkable-text-in-dialog.html. Also a time to read the other articles.

0 comments:

Write your comment for this article How to add a linkable text in Dialog above!