Here you can find the source of shot(Activity activity)
public static Bitmap shot(Activity activity)
import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Rect; import android.view.Display; import android.view.View; public class Main { public static Bitmap shot(Activity activity) { View views = activity.getWindow().getDecorView(); views.buildDrawingCache();//ww w . ja v a 2 s . c o m Rect frames = new Rect(); views.getWindowVisibleDisplayFrame(frames); int statusBarHeights = frames.top; Display display = activity.getWindowManager().getDefaultDisplay(); int widths = display.getWidth(); int heights = display.getHeight(); views.layout(0, statusBarHeights, widths, heights - statusBarHeights); views.setDrawingCacheEnabled(true); Bitmap bmp = Bitmap.createBitmap(views.getDrawingCache()); return bmp; } }