List of usage examples for android.webkit WebView setDrawingCacheEnabled
@Deprecated public void setDrawingCacheEnabled(boolean enabled)
Enables or disables the drawing cache.
From source file:Main.java
public static Bitmap getWebViewShopshat(WebView webView) { webView.setDrawingCacheEnabled(true); webView.buildDrawingCache();/*from ww w . j a v a 2 s . c om*/ Picture snapShot = webView.capturePicture(); Bitmap bitmap = Bitmap.createBitmap(snapShot.getWidth(), snapShot.getHeight(), Bitmap.Config.ARGB_8888); //bitmap.eraseColor(Color.WHITE); Canvas c = new Canvas(bitmap); int state = c.save(); webView.draw(c); //c.restoreToCount(state); c.restore(); webView.destroyDrawingCache(); return bitmap; }
From source file:Main.java
public static Bitmap getBitmapForVisibleRegion(WebView webview) { Bitmap returnedBitmap = null;//from w w w . jav a2s. c o m webview.setDrawingCacheEnabled(true); returnedBitmap = Bitmap.createBitmap(webview.getDrawingCache()); webview.setDrawingCacheEnabled(false); return returnedBitmap; }