this is a sample code, make android Webview display asset HTML file

Screen Shot 2014-11-12 at 1.27.06 PM

Screen Shot 2014-11-12 at 1.27.18 PM

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.webkit.WebView;

public class Webview extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_webview);
        WebView wv;  
        wv = (WebView) findViewById(R.id.webview);  
        wv.loadUrl("file:///android_asset/chapter1.html");  
    }   
}

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply