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) */



  1. Pingback: Load html string into WebView in android «

  2. Pingback: new blog

Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.