-1

I am developing a android app, I need some help from experts, my scenario is below.

I am storing html(text) in SQlite database, in that html I have some images, can I load those images from assets folder.

I load html from database, images(src) in that html should point to assets folder.

Please add your suggestions and comments.

Thanks, Ashok

1 Answers1

3

Just add the corresponding uri in the src attribute of your img elements using the file:///android_asset/your_image.png uri schema. For example...

<img src="file:///android_asset/image_name.png" />

Make sure you specify the base url when loading the html into the WebView

webView1.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "utf-8", null);
Leo
  • 14,625
  • 2
  • 37
  • 55