Java tutorial
//package com.java2s; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.util.DisplayMetrics; import android.view.View; import android.view.WindowManager; public class Main { public static Bitmap snapShotWithStatusBar(Activity activity) { View decorView = activity.getWindow().getDecorView(); decorView.setDrawingCacheEnabled(true); decorView.buildDrawingCache(); Bitmap bmp = decorView.getDrawingCache(); int width = getScreenWidth(activity); int height = getScreenHeight(activity); Bitmap bitMap = null; bitMap = Bitmap.createBitmap(bmp, 0, 0, width, height); decorView.destroyDrawingCache(); return bitMap; } public static int getScreenWidth(Context context) { return getDisplayMetrics(context).widthPixels; } public static int getScreenHeight(Context context) { return getDisplayMetrics(context).heightPixels; } public static DisplayMetrics getDisplayMetrics(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); DisplayMetrics displayMetrics = new DisplayMetrics(); windowManager.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics; } }