ycz ycz - 1 year ago 94
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
Answer Source

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.
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download