I would like to add three hyperlinks a Preference screen, which makes use of the PreferenceActivity if possible. Can I do this, if so, could someone provide support?
Many thanks,
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With