I am just started Android application development. Here i have a simple Activity which contains a WebView. It works fine when i try to open a website (like http://www.google.com). But i want to open a html file (assume index.html) file which i created in my application's 'res' directory. Full path is 'res/base/index.html'. Then how to open this file in my WebView.?
Working :
webview.loadUrl("http://www.google.com");
Not Working :
webview.loadUrl("./res/base/index.html");
Please help me. :)
Put the file in your /assets
directory and use:
webview.loadUrl("file:///android_asset/index.html");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With