Aug 28, 2011

Load local HTML from /assets

We can load local HTML (under /assets folder) in WebView.

Load local HTML from /assets

Modify from the former post Handle the Back button in WebView, to back in history.

Create our local HTML, /assets/myweb.html.
<!DOCTYPE html>

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width; user-scalable=0;" />
<title>Android Coding</title>

It's a local html in /assets.<br/>
Visit <a href="">Android Coding</a>


Load the local HTML in Java code:

final String DEFAULT_URL = "file:///android_asset/myweb.html";


No comments:

Post a Comment

Infolinks In Text Ads