In my preference activity I have one preference that links to a website (eg. stackoverflow.com). The code works fine in everything EXCEPT a Google TV emulator. On the Google TV emulator clicking the preference creates a Force Close.
Log Cat says "02-21 12:13:59.684: E/AndroidRuntime(1993):
android.content.ActivityNotFoundException: No Activity found to handle
Intent { act=android.intent.action.VIEW dat=http://www.stackoverflow.com }
Here is my code that I'm using...
getPreferenceManager().findPreference("pref_visit_web").setOnPrndeferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent v = new Intent(Intent.ACTION_VIEW);
v.setData(Uri.parse("http://www.stackoverflow.com"));
startActivity(v);
return false;
}
});
Sorry. Chrome is not installed on the Google TV Emulator (and there is therefore no browser available to handle that intent) [at least as of now].
It should work on a real device though.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.