Code example for Bitmap

Methods: copyisRecycled

0
    } 
 
    @Override 
    public void draw(final Canvas canvas) {
        if (isCacheEnabled) {
            if (cache == null || cache.isRecycled()) {
                updateCache(); 
            } 
            if (cache != null && !cache.isRecycled()) {
                canvas.drawBitmap(cache, null, new Rect(0, 0, getWidth(), getHeight()), paint);
            } 
        } else { 
            super.draw(canvas);
        } 
    } 
 
    public void enableCache() { 
        if (!isCacheEnabled && android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
            updateCache(); 
            isCacheEnabled = true;
        }