Make CacheableImageView gone and visible issue
alexzaitsev opened this issue · 1 comments
First of all thanks for the library. I use CacheableImageView and I think there is unexpected behavior.
To reproduce:
- mImageView.setImageBitmap(bitmap);
- mImageView.setVisibility(View.GONE);
- mImageView.setVisibility(View.VISIBLE).
After this I have get:
04-23 16:36:05.401: E/AndroidRuntime(4435): FATAL EXCEPTION: main
04-23 16:36:05.401: E/AndroidRuntime(4435): java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4056fa50
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.graphics.Canvas.throwIfRecycled(Canvas.java:973)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.graphics.Canvas.drawBitmap(Canvas.java:1062)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:325)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.widget.ImageView.onDraw(ImageView.java:935)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.View.draw(View.java:6970)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.View.draw(View.java:6973)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1732)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.drawChild(ViewGroup.java:1730)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.View.draw(View.java:6973)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.widget.FrameLayout.draw(FrameLayout.java:357)
04-23 16:36:05.401: E/AndroidRuntime(4435): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1997)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewRoot.draw(ViewRoot.java:1600)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewRoot.performTraversals(ViewRoot.java:1321)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.view.ViewRoot.handleMessage(ViewRoot.java:1957)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.os.Handler.dispatchMessage(Handler.java:99)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.os.Looper.loop(Looper.java:150)
04-23 16:36:05.401: E/AndroidRuntime(4435): at android.app.ActivityThread.main(ActivityThread.java:4277)
04-23 16:36:05.401: E/AndroidRuntime(4435): at java.lang.reflect.Method.invokeNative(Native Method)
04-23 16:36:05.401: E/AndroidRuntime(4435): at java.lang.reflect.Method.invoke(Method.java:507)
04-23 16:36:05.401: E/AndroidRuntime(4435): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-23 16:36:05.401: E/AndroidRuntime(4435): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-23 16:36:05.401: E/AndroidRuntime(4435): at dalvik.system.NativeStart.main(Native Method)
If before setImageBitmap I cache my bitmap I can't even set it because of this error is happened when I try to set a cached bitmap.
I've disabled RecyclePolicy and everything works.