I am trying to display an image from a local assets directory on a ICS Android app.
The png is 40.png it's under appname\assets\40.png The string in string.xml is:
<string name="p40"><img src="file:///android_asset/40.png"/></string>
And here is the code I use to load the IMG:
String myhtmlIMG= getResources().getString(R.string.p40);
webView.loadData(myhtmlIMG,"text/html", null);
When I run with this I get an exception:
06-11 15:02:04.986: W/System.err(12939): at libcore.net.http.AbstractHttpInputStream.checkNotClosed(AbstractHttpInputStream.java:68)
06-11 15:02:04.986: W/System.err(12939): at libcore.net.http.FixedLengthInputStream.read(FixedLengthInputStream.java:41)
06-11 15:02:04.990: W/System.err(12939): at java.io.InputStreamReader.read(InputStreamReader.java:244)
06-11 15:02:04.990: W/System.err(12939): at java.io.BufferedReader.fillBuf(BufferedReader.java:130)
06-11 15:02:04.990: W/System.err(12939): at java.io.BufferedReader.readLine(BufferedReader.java:354)
However if I was to make an html file in appname\assets\p40.html and include the same tags I would get the image. Problem is I must use dynamic png inserted into a html string so this is not a solution.
Is it my quote handling perhaps?