Created
June 20, 2014 05:54
-
-
Save laaptu/378d9c8fe08caf5f75ec to your computer and use it in GitHub Desktop.
TextView with autolink or link on a dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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