private void setBitmap(Bitmap bitmap) { if (bitmap != null && bitmap.getWidth() == -1 && bitmap.getHeight() == -1) { return; } if (this.bitmap != bitmap) { if (bitmap != null) { if (this.bitmap != null) { this.bitmap.recycle(); } bitmapWeakReference = new SoftReference<Bitmap>(bitmap); documentView.postInvalidate(); } this.bitmap = bitmap; } }