Here you can find the source of printScreen(View v)
public static Bitmap printScreen(View v)
//package com.java2s; import java.io.ByteArrayOutputStream; import android.graphics.Bitmap; import android.view.View; public class Main { public static byte[] printScreen(View v, int quality) { if (quality == -1) quality = 100;// www . j ava 2s. c om ByteArrayOutputStream baos = new ByteArrayOutputStream(); v.setDrawingCacheEnabled(true); v.buildDrawingCache(true); Bitmap bitmap = v.getDrawingCache(); bitmap.compress(Bitmap.CompressFormat.JPEG, quality, baos); return baos.toByteArray(); } public static Bitmap printScreen(View v) { v.setDrawingCacheEnabled(true); v.buildDrawingCache(); return v.getDrawingCache(); } }