开发者

Web Page Not Available - Loading local HTML on Android

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜