Here you can find the source of getBitmapFromView(View view)
public static Bitmap getBitmapFromView(View view)
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.Drawable; import android.view.View; public class Main { public static Bitmap getBitmapFromView(View view) { Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(returnedBitmap); Drawable bgDrawable = view.getBackground(); if (bgDrawable != null) bgDrawable.draw(canvas);/*from ww w . j a v a 2 s. c om*/ else canvas.drawColor(Color.WHITE); view.draw(canvas); return returnedBitmap; } }