How to display HTML images along with the text in android.?

I am new to android development. I am using webview to display HTML pages in android, but only the text shows up. Can you please help me with the problem. thank you in advance, would be very helpful.

WebView view = (WebView) this.findViewById(R.id.webView); try{ InputStream stream = this.getAssets().open("Capacitor Code Calculator.html"); int streamsize = stream.available(); byte[] buffer = new byte[streamsize]; stream.read(buffer); stream.close(); String html = new String(buffer); view.loadData(html,"text/html", "utf-8"); } catch (Exception e){ e.printStackTrace();

Does it have to do something with "text/html" in view.loadData(html,"text/html", "utf-8");

I have my html and image file both in assets folder.

-------------Problems Reply------------

It might be that you can't have spaces in your file name in the line:

InputStream stream = this.getAssets().open("Capacitor Code Calculator.html");

What is the url you're giving in the <img> tag? Do you have spaces in this name also?

Category:android Views:29 Time:2019-03-23

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.111 (s). 11 q(s)