简体   繁体   English

如何链接到Google TV中的网站?

[英]How to link to a website in Google TV?

In my preference activity I have one preference that links to a website (eg. stackoverflow.com). 在我的首选项活动中,我有一个首选项可以链接到网站(例如stackoverflow.com)。 The code works fine in everything EXCEPT a Google TV emulator. 该代码可以在除Google TV模拟器之外的所有内容中正常运行。 On the Google TV emulator clicking the preference creates a Force Close. 在Google TV模拟器上,单击首选项会创建一个“强制关闭”。

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]. Chrome尚未安装在Google TV仿真器上(因此没有浏览器可以处理该意图)(至少到目前为止)。

It should work on a real device though. 它应该可以在真实设备上运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM