i want to show the image on the following link in the webview in my android app. any idea how to do that ? image link is given below. image link
Asked
Active
Viewed 1,214 times
2 Answers
0
Please check below code use into Activity On Create
WebView webView = (WebView) findViewById(R.id.mwebview);
String mStringUrl = "http://api.androidhive.info/images/sample.jpg";
webView.loadDataWithBaseURL(null, "<html><head></head><body><table style=\"width:100%; height:100%;\"><tr><td style=\"vertical-align:middle;\"><img src=\"" + mStringUrl + "\"></td></tr></table></body></html>", "html/css", "utf-8", null);
OR
WebView webView = (WebView) findViewById(R.id.mwebview);
String mStringUrl = "http://api.androidhive.info/images/sample.jpg";
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(mStringUrl);
In XML
<WebView
android:id="@+id/mwebview"
android:layout_width="fill_parent"
android:layout_height="250dp"></WebView>

Yogesh Borhade
- 694
- 1
- 10
- 24