<p dir="auto"><strong>Glide Version</strong>:3.7.0<br>
<strong>Device/Android Version</strong>:5.1<br>
I'm using Glide to get Bitmap from network and use SimpleTarget to async draw the Bitmaps on my CustomView.And I use this view in RecyclerView.</p>
<p dir="auto">code in my CustomView:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private void loadBitmap(int i) {
        Glide.with(getContext()).load(mImageUrls.get(i)).asBitmap().dontAnimate().dontTransform().into(glideTarget);
}

private SimpleTarget&lt;Bitmap&gt; glideTarget = new SimpleTarget&lt;Bitmap&gt;() {
        @Override
        public void onResourceReady(Bitmap resource, GlideAnimation&lt;? super Bitmap&gt; glideAnimation) {
            mBitmaps.add(resource);
            invalidate();
    };

 @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();      
        Glide.clear(glideTarget);  
    }

 @Override
    protected void onDraw(Canvas canvas) {
          //...do draw Bitmaps like gridview but in single view
    }"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-smi">void</span> <span class="pl-s1">loadBitmap</span>(<span class="pl-smi">int</span> <span class="pl-s1">i</span>) {
        <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-en">getContext</span>()).<span class="pl-en">load</span>(<span class="pl-s1">mImageUrls</span>.<span class="pl-en">get</span>(<span class="pl-s1">i</span>)).<span class="pl-en">asBitmap</span>().<span class="pl-en">dontAnimate</span>().<span class="pl-en">dontTransform</span>().<span class="pl-en">into</span>(<span class="pl-s1">glideTarget</span>);
}

<span class="pl-k">private</span> <span class="pl-smi">SimpleTarget</span>&lt;<span class="pl-smi">Bitmap</span>&gt; <span class="pl-s1">glideTarget</span> = <span class="pl-k">new</span> <span class="pl-smi">SimpleTarget</span>&lt;<span class="pl-smi">Bitmap</span>&gt;() {
        <span class="pl-c1">@</span><span class="pl-c1">Override</span>
        <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">onResourceReady</span>(<span class="pl-smi">Bitmap</span> <span class="pl-s1">resource</span>, <span class="pl-smi">GlideAnimation</span>&lt;? <span class="pl-en">super</span> <span class="pl-smi">Bitmap</span>&gt; <span class="pl-s1">glideAnimation</span>) {
            <span class="pl-s1">mBitmaps</span>.<span class="pl-en">add</span>(<span class="pl-s1">resource</span>);
            <span class="pl-en">invalidate</span>();
    };

 <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">protected</span> <span class="pl-smi">void</span> <span class="pl-en">onDetachedFromWindow</span>() {
        <span class="pl-en">super</span>.<span class="pl-en">onDetachedFromWindow</span>();      
        <span class="pl-smi">Glide</span>.<span class="pl-en">clear</span>(<span class="pl-s1">glideTarget</span>);  
    }

 <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">protected</span> <span class="pl-smi">void</span> <span class="pl-en">onDraw</span>(<span class="pl-smi">Canvas</span> <span class="pl-s1">canvas</span>) {
          <span class="pl-c">//...do draw Bitmaps like gridview but in single view</span>
    }</pre></div>
<p dir="auto">The issue is if I declare <code class="notranslate">glideTraget</code> as fields and I scroll the RecyclerView ,some Image will missmatch.BUT if I create <code class="notranslate">glideTraget</code> each time for <code class="notranslate">into</code>,everything is fine.</p>
<p dir="auto">full code is free to touch:<br>
<a href="https://github.com/xufan/MultipleImageView">https://github.com/xufan/MultipleImageView</a></p>
<p dir="auto"><strong>Glide Version</strong>:3.6.1</p>

<p dir="auto"><strong>Integration libraries</strong>:no</p>

<p dir="auto"><strong>Device/Android Version</strong>:Fails on all devices</p>
<p dir="auto">So I am using Glide to load a web url .into imageviews in a gridview successfully.  In each of these grid elements, I have an onclick listener through which I want to pass the Glide bitmap to a new activity.  I know I can aquire the bitmap from glide with a callback, but for memory reasons (there are a lot of images) I do not want essentially two copies of all the images in memory.</p>
<p dir="auto">So I am trying to only load the one that actually needs to be passed by accessing it in the onClickListener of the gridview element:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="gridElement.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            object.setBitmapt(((BitmapDrawable)cover.getDrawable()).);
            ...
        }
    } "><pre class="notranslate"><code class="notranslate">gridElement.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            object.setBitmapt(((BitmapDrawable)cover.getDrawable()).);
            ...
        }
    } 
</code></pre></div>
<p dir="auto">However, I get an exception <code class="notranslate">java.lang.ClassCastException: com.bumptech.glide.request.target.SquaringDrawable cannot be cast to android.graphics.drawable.BitmapDrawable</code>, presumably because Glide has its own object in the ImageView.  I cannot find any documentation on the SquaringDrawable.</p>
<p dir="auto">tl;dr:  How can I get a bitmap from an ImageView that Glide was used on in the far future, after Glide has done it's thing?</p>