Wendigovo StackDump

How to display HTML page in Android WebView

In layout definition instate WebView:

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

(It also can be created dynamicaly in code.)

URL has to be set from activity, there is no way to set it in XML layout definition:

import android.webkit.WebView;

WebView webView = (WebView) findViewById(R.id.webview);
webView.loadUrl("file:///android_asset/index.html");

Note: "file:///android_asset/index.html" means "assets/index.html" in project directory.

Some features must be enabled explicitly, if you want to use them:

import android.webkit.WebSettings; 

WebSettings wSettings = webView.getSettings();
// enable JavaScript (most common need)
wSettings.setJavaScriptEnabled(true);
// enable HTML localStore (if you want it)
wSettings.setDomStorageEnabled(true);