I am having difficulty in loading a html file from my project assets folder into a webview. I have looked at dozens of tutorials and solutions but none seem to work for me.
In my project's assets folder I have two simple html files. index.html and faq.html
(The plan is to utilise this structure for my help documentation)
My code:
WebView wv = (WebView)findViewById(R.id.webview1);
wv.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
wv.loadUrl("file:///android_asset/index.html");
The webview displays the following:
Web Page Not Available
The Web Page at file:///android_asset/index.html could not be loaded as:
The requested file was not found. index.html
From everything I have read what I have here should work, but it does not.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…