Canvas: trying to use a recycled bitmap android.graphics.Bitmap


     java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@b66e6ff
                                                                   at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1271)
                                                                   at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:257)
                                                                   at android.graphics.Canvas.drawBitmap(Canvas.java:1415)
                                                                   at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
                                                                   at android.widget.ImageView.onDraw(ImageView.java:1286)
                                                                   at android.view.View.draw(View.java:17096)
                                                                   at android.view.View.updateDisplayListIfDirty(View.java:16078)
                                                                   at android.view.View.draw(View.java:16862)
                                                                   at android.view.ViewGroup.drawChild(ViewGroup.java:3766)
                                                                   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3552)

探索,证实bitmap如果被用到视图上显示,那么这个bitmap一定不能进行回收,否则即使当时没报错,关闭屏幕回来 或者调用buildCache方法还是会报错,如果觉得bitmap过大,应该之前就进行压缩处理。

你可能感兴趣的:(Canvas: trying to use a recycled bitmap android.graphics.Bitmap)