Android手动释放Bitmap方法
程序员文章站
2022-03-16 16:44:58
Android手动释放Bitmap方法
public static void releaseImageViewResouce(ImageView imageView) {...
Android手动释放Bitmap方法
public static void releaseImageViewResouce(ImageView imageView) { if (imageView == null) return; Drawable drawable = imageView.getDrawable(); if (drawable != null && drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; Bitmap bitmap = bitmapDrawable.getBitmap(); if (bitmap != null && !bitmap.isRecycled()) { bitmap.recycle(); } } }