Tuesday, 17 June 2014

how to take screenshot in android

public static void takeScreenShotForPage(RelativeLayout webView,
Context context, String path, String fileName) {
try {
webView.setDrawingCacheEnabled(true);

webView.buildDrawingCache(true);
Bitmap bitmap1 = null;
System.gc();
bitmap1 = Bitmap.createBitmap(webView.getDrawingCache(true));
Bitmap bmp = Common.getResizedBitmap(bitmap1, 150, 100);
webView.setDrawingCacheEnabled(false);

} catch (Exception e) {
e.printStackTrace();
}

}

No comments:

Post a Comment