Yo guys, this is bugging me and I can't find a fix for it,
I have a simple activity to launch a WebView and display a HTML file
public class HelpViewer extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.help_page_layout);
WebView browser = (WebView) findViewById(R.id.help_page_开发者_如何学Gowebview);
browser.loadUrl("file:///android_asset/help.html/");
}}
The help_page_layout is your standard WebView resting in a LinearLayout - Not problems there.
The help.html is sitting under the /res/raw/ directory. From what I have see online, there shouldn't be a problem here either.
But when the WebView goes to load, it just tells me that the WebPage was not available because help.html couldn't be found.
What am I doing wrong?
This question suggests the file should be in /assets
rather than /res/raw
. You also have a trailing slash on the end of your URL.
精彩评论