从Android应用启动Chrome,但指向本地内容

时间:2015-05-28 21:20:20

标签: android google-chrome

因此,在我的应用中,我可以使用以下代码启动Chrome并使用http://加载页面。

我的问题是,当我尝试加载本地存储在设备上的内容时。即file:///,我进一步误解了。

有关如何解决此问题的任何想法?

代码:

String urlString="file:///storage/emulated/0/Download/primer.html";
Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(urlString));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.android.chrome");
startActivity(intent);

错误:

  

android.content.ActivityNotFoundException:找不到要处理的Activity   意图{act = android.intent.action.VIEW   DAT =文件:///storage/emulated/0/Download/cuescript_primer.html   flg = 0x10000000 pkg = com.android.chrome}

0 个答案:

没有答案