回收bitmap缓存出现错误 trying to use a recycled bitmap

在listview的adapter中 加载图片之后调用回收图片缓存的方法
BitmapDrawable bd = (BitmapDrawable) relativeLayout.getBackground();
BitmapDrawable bd = (BitmapDrawable) relativeLayout.getBackground();
if (bd != null) {
bd.setCallback(null);
if (bd.getBitmap() != null) {
if (!bd.getBitmap().isRecycled()) {

                    bd.getBitmap().recycle();
                }
            }
        }

在getview的最后执行上面的函数时产生错误ava.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@2cc96c28
想请教一个这里的问题要如何解决?

在listview 的adapter中其内部会做好复用,无需你自己去处理receycle

http://diyidaima.com/article/detail/wQErjEce