I have a HTML file in my /res/raw/test.html
and i show it in web view using following code
WebView wbview = (WebView)findViewById(R.id.webView1);
InputStream fin;
try
{
fin = getResources().openRawResource(R.raw.manual);
byte[] buffer = new byte[fin.available()];
fin.read(buffer);
fin.close();
wbview.loadData(new String(buffer), "text/html", "UTF-8");
}
catch (IOException e)
{
e.printStackTrace();
}
And this is my code of my HTML file
<html>
<p>
Lorem ipsum dolor sit amet,
</p>
<table>
<tr>
<td>
<img src=\\"file:///android_asset/test_image2.jpg\"/>
<img src="test_image2.jpg" width="50px" alt="Hi">
<img src=\"res/drawable/test_image.png"/>
<img src="file:///android_res/drawable/test_image.png" />
<img src=\"file:///android_res/drawable/test_image.png"\ />
</td>
</tr>
</table>
</html>
I want to display the image from my resource folder in my html file…
i tried all possibility still not work. It’s just show a HTML text but for a image i don’t have idea how to show it
Please help me
You can load your html page from android assets folder like below code.
and also you need to make your html like this below .