Code example for SpannableString

Methods: addLinks, setMessage

public class DialogUtils { 
    // See bug report: 
    // From workaround at 
    public static void showHTMLDialog(Context context, String html) {
        // Linkify the message 
        final SpannableString s = new SpannableString(Html.fromHtml(html));
        Linkify.addLinks(s, Linkify.ALL);
        final AlertDialog d = new AlertDialog.Builder(context)
                .setPositiveButton(android.R.string.ok, null)
        // Make the textview clickable. Must be called after show() 
        ((TextView) d.findViewById(;
Contextual code suggestions in your IDE  Get Codota for Java