Skip to content

Instantly share code, notes, and snippets.

@laaptu
Created June 20, 2014 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laaptu/378d9c8fe08caf5f75ec to your computer and use it in GitHub Desktop.
Save laaptu/378d9c8fe08caf5f75ec to your computer and use it in GitHub Desktop.
TextView with autolink or link on a dialog
final TextView tv = new TextView(this);
final SpannableString s = new SpannableString(result);
Linkify.addLinks(s, Linkify.WEB_URLS);
tv.setText(s);
tv.setMovementMethod(LinkMovementMethod.getInstance());
DialogFragment dg = new DialogFragment() {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return new AlertDialog.Builder(getActivity())
.setPositiveButton(android.R.string.ok, null)
.setView(tv)
.create();
}
};
dg.show(getSupportFragmentManager(), "success_dialog");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment