1

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_webview);
    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?

Mark D
  • 1,309
  • 4
  • 19
  • 38

1 Answers1

2

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.

Community
  • 1
  • 1
dave.c
  • 10,910
  • 5
  • 39
  • 62