Here you can find the source of getBitmapFromView()
private static Bitmap getBitmapFromView()
//package com.java2s; import android.graphics.*; import android.view.View; public class Main { private static View mCreateView; private static Bitmap getBitmapFromView() { Bitmap bitmap = null;/*from w w w. jav a 2 s. co m*/ try { int width = mCreateView.getWidth(); int height = mCreateView.getHeight(); if (width != 0 && height != 0) { bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); mCreateView.layout(0, 0, width, height); mCreateView.draw(canvas); } } catch (Exception e) { bitmap = null; e.getStackTrace(); } return bitmap; } }