打开sd卡中的HTML文件时报错, 提示android.content.ActivityNotFoundException: No Activity found to handle Intent . 奇怪的是机器上装有浏览器啊. 后来检查Intent参数发现:
少了项: shortcutIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity");参数.
打开SDcard中的HTML完整Intent写法为:
Intent shortcutIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("file://sdcard/nav.html"));
shortcutIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity"); //此处指定系统自带浏览器包名和Activity名称.