0

Hi i am trying to dynamically load new content on my webview and on devices and emulators higher then 2.x, it works fine but on devices lower it doesnt.

No errors get thrown in the logs. Instead, the webview doesnt display the new content at all.

i am displaying a new content such as a picture like this

webView.loadData(imageInBase64, "image/png", "base64"); 

the imageInBase64 basically extracts the bites from a file image and then encodes it to base64. that part works fine(or could this be the issue where base64 doesnt work on older OS's?)

any advice on what could be the issue or if there is another way to load content into a webview?

Thanks

1
  • Anyone with some advice? Commented Jun 18, 2013 at 21:12

1 Answer 1

1

Try one of the following:

webView.loadUrl("data:image/png;base64," + imageInBase64); 

or

webView.loadData("<html><head>" + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">" + "<style type=\"text/css\">*{ margin: 0; padding: 0; }</style>" + "</head><body><img src=\"data:image/png;base64," + imageInBase64 + "\"/>" + "</body></html>"); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.