How to add a hyperlink into a Preference Screen (PreferenceActivity)
You don't want "hyperlinks", then. You want entries in the PreferenceScreen
that, when tapped, launch some activity, such as to bring up a Web page on your desired URL.
That is covered by the <intent>
element:
<Preference android:title="@string/prefs_web_page" > <intent android:action="android.intent.action.VIEW" android:data="http://www.example.com" /></Preference>
Include those in your preference XML that you use to populate your PreferenceScreen
, and when the user taps on the preference entry, your requested activity will start.
Java version is something like this:
PreferenceScreen link = man.createPreferenceScreen(this);this.setIntent(new Intent().setAction(Intent.ACTION_VIEW).setData( Uri.parse("https://rogerkeays.com")));link.setTitle(R.string.link_title);link.setSummary(R.string.link_summary);// add to containing group// group.addPreference(link);