Android View to Image Capture convertViewToBitmap(View view)

Here you can find the source of convertViewToBitmap(View view)

Description

convert View To Bitmap

License

Open Source License

Declaration

public static Bitmap convertViewToBitmap(View view) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Bitmap;

import android.view.View;
import android.view.View.MeasureSpec;

public class Main {
    public static Bitmap convertViewToBitmap(View view) {
        view.measure(/*from w w  w .j  a  va  2 s .c o m*/
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
        view.buildDrawingCache();
        Bitmap bitmap = view.getDrawingCache();
        return bitmap;
    }
}

Related

  1. captureWebView(WebView webView)
  2. captureWebViewVisibleSize(WebView webView)
  3. getBitmapFromView(View view)
  4. printScreen(View v)
  5. printScreen(View v, int quality)
  6. shotScreen(View cv)