3
Webview wv=(WebView)findViewById(R.id.webview1);
``String str="<html>
            <body>
            <img src='file:///android_asset/nag.png' height='300' width='200'/>
            </body>
            </html>";
wv.loadData(str,"text/html","UTF-8");
1
  • Load webview with BaseURL given code in my answer Commented Jan 20, 2014 at 9:36

1 Answer 1

3

Try using this code

wv.loadDataWithBaseURL("file:///android_asset/", str, "text/html", "UTF-8",null);

Instead of

wv.loadData(str,"text/html","UTF-8");
Sign up to request clarification or add additional context in comments.

2 Comments

Six years ago but still works like a charm. Thanks!
"file:///android_asset/" never knew this will be required for loading the URL from string

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.