ycz ycz - 1 month ago 11
Android Question

Android: Clickable hyperlinks in DialogPreference

What I'm trying to accomplish: create a clickabel hyperlink in the message text displayed by a DialogPreference.

My solution so far: follow this topic: link , and I am accomplished a formating hyperlink displayed in the DialogPreference, but this hyperlink not clickable.

Question:How to make the hyperlink clickable in the DialogPreference.

my code:

public class AboutDialog extends DialogPreference {
public AboutDialog(Context oContext, AttributeSet attrs)
super(oContext, attrs);
final SpannableString s = new SpannableString(oContext.getText(R.string.about_text));
Linkify.addLinks(s, Linkify.ALL);

viv viv

Well, I am not sure but try this :

  • Create textView, set your string s as it's text, using yourTextVeiw.setText(s)
  • set onClickListener for this textView
  • Now set this textView into dialog, try using addView(textview) , method.