Android手动释放Bitmap方法
程序员文章站
2022-07-01 08:53:19
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(); } } }