Display an image in the webview

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Display an image in the webview

Postby prachi_584 » Tue Nov 11, 2008 7:39 am


I have an HTML doc called test.html which I have kept in the raw folder. I want to display this doc in webview. Here's my code:

try {
InputStream is = getResources().openRawResource(R.raw.test);
int size = is.available() ;
byte[] buffer = new byte[size];

data = new String(buffer);

catch (Exception e) {
Log.e("", "ResourceUtils failed to load resource to string", e);

view.loadData(data, "text/html", "UTF-8");

The html doc also contains an image tag. Here's my html code:


<form name="input" action="html_form_action.asp" method="get">
<input type="radio" name="Sex" value="Male" checked="checked">
<input type="radio" name="Sex" value="Female">
<input type ="submit" value ="Submit">

If you click the "Submit" button, you will send your input to a new page.

An image:
<img src="icon.png"
width="144" height="50">


I want to display icon.png image. But it is unable to display the image.
I have kept this image in the same folder as that of html doc.
What is wrong with my code?
Need help!!!!

User avatar
Posts: 6
Joined: Tue Nov 04, 2008 6:28 am


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests