How To Convert A Webview Into An Imageview?
i have a WebView of an html page which shows only one image http://www.google.fr/intl/en_com/images/srpr/logo1w.png webView = (WebView) findViewById(R.id.webView); webView.loadUrl(
Solution 1:
try this:
webView.buildDrawingCache();
Bitmapbmap= imageView.getDrawingCache();
imageView.setImageBitmap(bmap);
Solution 2:
You can open an InputStream
pointing to the image URL (using URLConnection
), and create a Drawable
from it using Drawable.createFromStream
. You can then set the Drawable
onto the ImageView
.
Solution 3:
As per your above comment: ok you are right it must be easier getting the image directly... how do i do that ? Do i look in bitmap doc ?
, i assume you want to load image from web and want to display the same in imageview, if this is the case then refer this to get exactly: How to display image from URL on Android
Solution 4:
Bitmapbtmp= mwebview.getDrawingCache(true);
this will return the Bitmap image in webview.
And the bitmap can be set to image view by:
imageView.setImageBitmap(bmap);
Post a Comment for "How To Convert A Webview Into An Imageview?"