Method of Use: Recyclebitmap.recycleimageview (Mselectorview); parameter is ImageView
/**
* Recover image memory occupied by ImageView;
* After using this method, please remember to use
* System.GC (); Alert System for timely recovery
* @param view
* There is no bitmap in front of the Setimageresource () method, the picture can be come out.
* After executing this method, the image will not be displayed.
* There is no bitmap in front of the Setimagebitmap () method, the picture can come out.
* After executing this method, the image will not be displayed.
* It is best to perform this method in the OnDestroy method
*/
Public Static voidRecycleimageview (view view) {if(view==NULL)return; if(ViewinstanceofImageView) {drawable drawable=((ImageView) view). Getdrawable (); if(drawableinstanceofbitmapdrawable) {Bitmap BMP=((bitmapdrawable) drawable). Getbitmap (); if(BMP! =NULL&&!bmp.isrecycled ()) {(ImageView) view). Setimagebitmap (NULL); Bmp.recycle (); Log ("Have recycled ImageView Bitmap"); BMP=NULL; } } } }
Method of Use: Recyclebitmap.recyclebitmap (MNO_SHOP1BITMAP); parameter is bitmap
/**
* Can be released to bitmap on the C layer of the requested memory, the Recycle method will put some relevant reference count 0.
* Recover image memory occupied by bitmap;
* After using this method, please remember to use
* System.GC (); Alert System for timely recovery
* @param bitmap
* Exceptions are reported before and after the Setimagebitmap () method, preferably in the OnDestroy method
* Runtimeexception:trying to use a recycled bitmap [email protected]
*/
Public Static void Recyclebitmap (Bitmap Bitmap) { if(bitmap!=null&&! Bitmap.isrecycled ()) { bitmap.recycle (); // Reclaim the memory of a picture Log ("has recycled Bitmap"); Bitmap=null; } }
Reclaim ImageView-occupied image memory