gpt4 book ai didi

local - 在 android 3.x 中使用 android-browser 打开本地 html-file

转载 作者:行者123 更新时间:2023-12-01 19:15:07 24 4
gpt4 key购买 nike

对于 android 2.x,我可以使用该解决方案

browserIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity") 

帖子中已解决:

opening local html file with Android Browser

但是对于 android 3.2 我有这个错误:

Unable to find explicit activity class 
(com.android.browser/com.android.browser.BrowserActivity);
have you declared this activity in your AndroidManifest.xml?

我认为 Android 3.x 中不存在 com.android.browser.BrowserActivity

有什么解决办法吗?

最佳答案

不是一个令人满意的解决方案,但在演示应用程序中我选择使用以下代码:

String url = "content://com.android.htmlfileprovider/sdcard/mydir/myfile.html";
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), "text/html");
startActivity(intent);

通常至少是两部作品中的一部。

https://github.com/nicolas-raoul/OxygenGuide-Android/blob/master/src/org/github/OxygenGuide/MainActivity.java#L69

关于local - 在 android 3.x 中使用 android-browser 打开本地 html-file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10104244/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com