0

I try to load the html file with this line. (I get file name from intent)

webView.loadUrl("file:///android_res/raw/content/" + file + ".html");

The html file is at:

/raw/res/content/1-introduction.html

I get this error:

The webpage at "file:///android_res/raw/content/1-introduction.html" couldn't be loaded because net:ERR_FILE_NOT_FOUND

What am I missing?

tolga
  • 2,462
  • 4
  • 31
  • 57

2 Answers2

0

To load files packed in your application, you should use special WebViewAssetLoader. There is a full guide. In general, you have to use special path handlers to operate local files.

S-Sh
  • 3,564
  • 3
  • 15
  • 19
0

I moved my files into /assets/content folder and called like this. Worked.

webView.loadUrl("file:///android_asset/content/" + file + ".html");
tolga
  • 2,462
  • 4
  • 31
  • 57