get Bitmap From View by size - Android User Interface

Android examples for User Interface:View Bitmap

Description

get Bitmap From View by size

Demo Code


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

import android.view.View;

public class Main {
    public static Bitmap getBitmapFromView(View v, int width, int height) {
        Bitmap bitmap = Bitmap.createBitmap(width, height,
                Bitmap.Config.ARGB_8888);

        Canvas canvas = new Canvas(bitmap);
        v.draw(canvas);/* w ww  .  jav  a2  s.co  m*/
        return bitmap;
    }
}

Related Tutorials