3

Hi i have data that contains HTML image tag and some text. To display this content i am using webView by following approach:

String  getProductDetailsTechSpec = "<img src="http://myhost.com/myimages/image.jpg"/></br>Here is the content of my article.  Yada Yada.  Etc. Etc."
getProductDetailsTechSpec.loadDataWithBaseURL("", getTechSpec,
                "text/html", "UTF-8", "");

when device is connected to the wi-fi or mobile data, image is displying properly and when user turn off the wi-fi/Mobile data after some time image does not displaying(it works for few mins because webview get cached the image but after some time it doesn't) . But text is still is working. Please give me suggestion hot to get rid of this problem. Thanks in advance.

rupesh
  • 2,865
  • 4
  • 24
  • 50

1 Answers1

0

The text is working because simply the webview is able to draw the HTML tags that you're writing even if there is no internet connection .. just like if your write that HTML to a text file and run in with the browser in your computer .. But for the image the webview displays it from a URL which needs connection to display it if your're looking for a way to cache the image , you might wanna check out that link

Community
  • 1
  • 1
elmorabea
  • 3,243
  • 1
  • 14
  • 20
  • is there any specific time till then images will be visible? – rupesh May 07 '14 at 11:14
  • Sorry, i don't know the exact caching policy of the webviews. On the other hand i recommend that you download the image and cache it away from the webview and display the webview under it or something with only HTML text tags – elmorabea May 07 '14 at 11:16