Clear Bitmap data and make it null
Posted
by
Arun
on Stack Overflow
See other posts from Stack Overflow
or by Arun
Published on 2012-06-13T10:32:05Z
Indexed on
2012/06/13
10:40 UTC
Read the original article
Hit count: 208
android
I am working in an android application and I want to Clear my Bitmap data. The scenario is that I am taking a screen capture of an Widget(Imageview) and I am storing it in a Bitmap. This action comes in a Button click. SO after some time I get a Memory error. So I want to clear the values in the bitmap. So to do that I have done the following code : The BitMap variable is mCaptureImageBitmap
public void ButtonClick(View v)
{
mCaptureImageBitmap.recycle();
mCaptureImageBitmap=null;
View ve = findViewById(R.id.mainscreenGlViewRelativeLayout);
ve.setDrawingCacheEnabled(true);
mCaptureImageBitmap = ve.getDrawingCache();
}
But I get an error of NullPoint exception. Please help me
© Stack Overflow or respective owner