android - Load an external html file into webview -
i'm having problems loading external html file webview. i've done before , should easy, reason keep getting web page not available.
i know files in directory because placed them myself using file explorer.
string filename = "file:///"+ environment.getexternalstoragedirectory() + file.separator + "android/data/com.example/files/test_html2.html"; webview.loadurl(filename); i've tried moving files root , trying there, i've removed file:// , replaced content:// , nothing @ all. have read permissions in manifest.
any ideas?
don't create file:// urls yourself, tend screw them up. in case, think have 4 slashes after :, 3 typed in , 1 environment.getexternalstoragedirectory().
instead, create file object , use basis:
file f = new file(environment.getexternalstoragedirectory(), "android/data/com.example/files/test_html2.html"); webview.loadurl(f.touri().tourl()); // or use uri.fromfile(f).tostring() instead
Comments
Post a Comment