Android View to Image Capture getBitmapFromView()

Here you can find the source of getBitmapFromView()

Description

get Bitmap From View

Declaration

private static Bitmap getBitmapFromView() 

Method Source Code

//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;
    }
}

Related

  1. printScreen(View v, int quality)
  2. shotScreen(View cv)
  3. view2Bitmap(View view)
  4. view2Bitmap(View view, boolean cache)
  5. loadBitmapFromView(View v)
  6. getBitmapFromView(View view)
  7. view2Bitmap(View view)
  8. view2Bitmap(View view)