Open html file located inside my application using WebView

android, webview

Solution

Put the file in your `/assets` directory and use:

webview.loadUrl("file:///android_asset/index.html");

Problem

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. :)

Original source