admin管理员组

文章数量:1613763

满意答案

代码 如下:

Intent intent=new Intent();

intent.setAction("android .intent.action.VIEW");

Uri CONTENT_URI_BROWSERS = Uri.parse("content://com.android.htmlfileprovider/sdcard/123.html");

intent.setData(CONTENT_URI_BROWSERS);

intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");

startActivity(intent);

假设要打开的本地html文件 存放在如下路径 /sdcard/123.html

如果出现错误:

Unable to find explicit activity class {

com.google.android.browser/com.android.browser.BrowserActivity};

have you declared this activity in your AndroidManifest.xml?

intent.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));

代替

intent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");

00分享举报

本文标签: 浏览器文件androidhtml