Android examples for User Interface:View Bitmap
convert View To Bitmap
//package com.java2s; import android.graphics.Bitmap; import android.view.View; public class Main { public static Bitmap convertViewToBitmap(View v) { v.setDrawingCacheEnabled(true);//w w w . j av a 2 s . c o m v.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); v.layout(0, 0, v.getMeasuredWidth(), v.getMeasuredHeight()); v.buildDrawingCache(true); Bitmap b = Bitmap.createBitmap(v.getDrawingCache()); v.setDrawingCacheEnabled(false); // clear drawing cache return b; } }