【发布时间】:2014-01-19 08:35:28
【问题描述】:
我必须将现有的 html 文件加载到位于文件系统中此路径的 WebView 中:
/data/data/com.example.example/files/file.html
但是,当WebView 加载它时,我什么也看不到。
谁能帮我?
WebView 代码(假设路径是我上面写的路径):
WebView webView = (WebView)findViewById(R.id.webView1);
File htmlFile = new File(path);
if(htmlFile.exists())
{
webView.loadUrl(htmlFile.getAbsolutePath());
}
【问题讨论】:
-
htmlFile.exists() 是否返回 true?如果是这样,您在 logcat 中看到了什么?
-
htmlFile.exists() 总是返回 true... 我试图将日志放入 if 并且 logcat 显示该日志...
标签: android html file webview local