I am creating a preference menu and would like to launch a browser (with a specific url) when a particular preference is clicked on. I know this can be done, but I cant seem to get it to work right now.
Any ideas?
Thanks
######SOLUTIONSo after my brain fart disappeared, this is what i did:
getPreferenceManager()
.findPreference("my_preference_key")
.setOnPreferenceClickListener(
new Preferences.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://some_url_here"));
startActivity(intent);
return true;
}
});
getPreferenceManager()
.findPreference("my_preference_key")
.setOnPreferenceClickListener(
new Preferences.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://some_url_here"));
startActivity(intent);
return true;
}
});
enter code here