This sample code helps you to load html from a string and from a file into webview in ANDROID.
String str = Your HTML String; /* use src='file:///android_asset/images/photo_3.jpg' for loading images from the assets /images folder */ /* To load from a string use loadDataWithBaseURL */ webview.loadDataWithBaseURL( "" ,str , "text/html" , "utf-8" , "" ); /* To load from a file use loadUrl(remote or local) */ webview.loadUrl( "file:///android_asset/test.html" ); |
Pingback: Load html string into WebView in android « tediscript.wordpress.com
Pingback: new blog