Loading existing .html file with android WebView

I did try samples, demos from Google codes and other resources with WebView, but when i try to do it in my own code, it doesn't work for me.

I want to load myfile.html which i put in assets folder, and using:

private WebView myWebView;

myWebView.loadUrl("file:///android_assets/myfile.html");

On emulator shows error

The web page at file:///android_assets/myfile.html could not be loaded as: The requested file was not found. /android_assets/myfile.html

When i put that file to res/raw/ folder and using:

myWebView.loadUrl("file:///android_res/raw/myfile.html");

then only emulator android 2.2 API level 8 can load the file probably, other older versions show the same error. Am i missing something?

Is there any way of loading an existing .html file in the application package which works on all API versions ?

85
задан skaffman 14 June 2014 в 01:15
поделиться