Reputation: 1862
I've putted a webview and with this code I use it with local html. Now, I'd like add images to this html but I don't know where put that images. Any advice?
String html = "<html><body>Hello, World!</body></html>";
String mime = "text/html";
String encoding = "utf-8";
WebView myWebView = (WebView)this.findViewById(R.id.myWebView);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.loadDataWithBaseURL(null, html, mime, encoding, null);
Upvotes: 0
Views: 122
Reputation: 23638
If you want to add the image in the html file then you need to make the changes as below:
String html ="<html><body>Hello, World!" + "<img src=\"C:/Users/Public/Pictures/Sample Pictures/pulpit.jpg\" alt=\"Pulpit rock\" width=\"304\" height=\"228\" /></body></html>";
Thanks.
Upvotes: 1