[英]Unable to load local HTML file in Android WebView
I have a WebView. 我有一个WebView。 I want to load a local HTML file called helloworld.html.
我想加载一个名为helloworld.html的本地HTML文件。 It is located in my drawable-hdpi folder.
它位于我的drawable-hdpi文件夹中。
Here is my code: 这是我的代码:
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("file:///android_asset/helloworld.html");
I get a browser error: 我收到浏览器错误:
The webpage at file:///android_asset/helloworld.html could not be loaded as the file requested was not found. /android_asset/helloworld.html (no such file or directory)
How can I resolve? 我怎么解决?
将您的HTML文件放在assets文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.