title: Canvas: trying to use a recycled bitmap crash on configuration change of fragment
body: <p>I have a listview inside a fragment. Each row of the listview has imageview and I'm loading bitmap image. I set the bitmap as a tag to the imageview. Next time when the image view with non-null tag is encountered, I'm recycling the bitmap in the tag and reloading image into it. This is causing crash "Canvas: trying to use a recycled bitmap android.graphics.Bitmap" crash when the orientation of the activity is changed. I couldn't figure out why this is happening. Please help.</p>
  
  <pre><code> Bitmap bitmap = (Bitmap) imageView.getTag();
      if (bitmap != null &amp;&amp; !bitmap.isRecycled()) {
          bitmap.recycle();
      }
      Ion.with(appContext)
              .load(uri)
              .asBitmap()
              .setCallback(new FutureCallback&lt;Bitmap&gt;() {
                  @Override
                  public void onCompleted(Exception e, Bitmap result) {
                      if (result != null) {
                          imageView.setImageBitmap(result);
                          imageView.setTag(result);
                      }
                  }
              });
  </code></pre>
  
  <p>Stack trace:
  java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@31a3918
                                                                                        at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1270)
                                                                                        at android.graphics.Canvas.drawBitmap(Canvas.java:1404)
                                                                                        at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:544)
                                                                                        at android.widget.ImageView.onDraw(ImageView.java:1228)
                                                                                        at android.view.View.draw(View.java:16184)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15180)
                                                                                        at android.view.View.draw(View.java:15954)
                                                                                        at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                                        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15175)
                                                                                        at android.view.View.draw(View.java:15954)
                                                                                        at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                                        at android.widget.ListView.drawChild(ListView.java:3418)
                                                                                        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                                        at android.widget.AbsListView.dispatchDraw(AbsListView.java:2615)
                                                                                        at android.widget.ListView.dispatchDraw(ListView.java:3413)
                                                                                        at android.view.View.draw(View.java:16187)
                                                                                        at android.widget.AbsListView.draw(AbsListView.java:4166)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15180)
                                                                                        at android.view.View.draw(View.java:15954)
                                                                                        at android.view.ViewGroup.drawChild(ViewGroup.java:3609)
                                                                                        at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3399)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15175)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3593)
                                                                                        at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3573)
                                                                                        at android.view.View.updateDisplayListIfDirty(View.java:15140)
                                                                                        at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
                                                                                        at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
                                                                                        at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)
                                                                                        at android.view.ViewRootImpl.draw(ViewRootImpl.java:2615)
                                                                                        at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2434)
                                                                                        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2067)
                                                                                        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
                                                                                        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
                                                                                        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
                                                                                        at android.view.Choreographer.doCallbacks(Choreographer.java:670)
                                                                                        at android.view.Choreographer.doFrame(Choreographer.java:606)
                                                                                        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
                                                                                      at android.os.Handler.</p>