[Solved] android: how to using image in asset folder in html to load in webview [duplicate]


Try this way its working for me

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    String sHtmlTemplate = "<html><head></head><body><img src=\"file:///android_asset/ic_launcher.png\"><p>Hello Webview.</p></body></html>";
    WebView wb = new WebView(this);

    wb.loadDataWithBaseURL(null, sHtmlTemplate, "text/html", "utf-8",null);
    setContentView(wb);


}
}

Output:

enter image description here

2

solved android: how to using image in asset folder in html to load in webview [duplicate]