强制回收ImageView的bitmap

来源:互联网 发布:非洲网络用户 编辑:程序博客网 时间:2024/05/17 02:32

BitmapDrawable bitmapDrawable = (BitmapDrawable) imageView.getDrawable();

//如果图片还未回收,先强制回收该图片

if(!bitmapDrawable.getBitmap().isRecycled())

{

    bitmapDrawable.getBitmap().recycle();

}

//然后再显示新的图片

imageView.setImageBitmap(BitmapFactory.decodeStream(assetFile));

0 0