我尝试在Chrome中默认打开我的网页,我该怎么办呢。 MyCode是:
try {
Intent i = new Intent("android.intent.action.VIEW");
i.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.example.webviewdemo.MainActivity"));
i.addCategory("android.intent.category.LAUNCHER");
i.setData(Uri.parse(url));
startActivity(i);
}
catch(ActivityNotFoundException e)
{
//exception raised
e.printStackTrace();
// Chrome is probably not installed
}
当我运行此活动时未找到异常显示错误
答案 0 :(得分:0)
试试这个,
internetIntent.setComponent(new ComponentName("com.android.chrome","com.android.browser.BrowserActivity"));
internetIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);