get View Drawing Cache - Android User Interface

Android examples for User Interface:View Property

Description

get View Drawing Cache

Demo Code


//package com.java2s;

import android.graphics.Bitmap;
import android.view.View;

public class Main {
    public static Bitmap getDrawingCache(View view) {
        view.setDrawingCacheEnabled(true);
        Bitmap bmap = view.getDrawingCache();
        Bitmap snapshot = Bitmap.createBitmap(bmap, 0, 0, bmap.getWidth(),
                bmap.getHeight(), null, true);
        view.setDrawingCacheEnabled(false);
        return snapshot;
    }//from  w  w  w . jav  a2 s .c o  m
}

Related Tutorials