draw View Onto Bitmap - Android User Interface

Android examples for User Interface:View Bitmap

Description

draw View Onto Bitmap

Demo Code


//package com.java2s;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;

import android.view.View;

public class Main {

    public static Bitmap drawViewOntoBitmap(View view) {
        Bitmap image = Bitmap.createBitmap(view.getWidth(),
                view.getHeight(), Config.RGB_565);
        Canvas canvas = new Canvas(image);
        view.draw(canvas);/*  w  w w.j  a  v a2s.  co  m*/
        return image;
    }
}

Related Tutorials