<p dir="auto">Hi,</p>
<p dir="auto">I am getting an exception when I try to execute following code</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="runOnDraw(new Runnable() {
    @Override
    public void run() {
        Glide.with(mContext)
             .load(mResIds.get(0))
             .asBitmap()
             .into(new SimpleTarget&lt;Bitmap&gt;() {
                     @Override public void onResourceReady(Bitmap resource, GlideAnimation&lt;? super Bitmap&gt;glideAnimation) {
                         //Bitmap b = BitmapFactory.decodeResource(mContext.getResources(), mResIds.get(0));
                         filterSourceTexture2 = OpenGlUtils.loadTexture(resource, OpenGlUtils.NO_TEXTURE, true);
                     }
             });
    }
});"><pre class="notranslate"><span class="pl-en">runOnDraw</span>(<span class="pl-k">new</span> <span class="pl-smi">Runnable</span>() {
    <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">run</span>() {
        <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">mContext</span>)
             .<span class="pl-en">load</span>(<span class="pl-s1">mResIds</span>.<span class="pl-en">get</span>(<span class="pl-c1">0</span>))
             .<span class="pl-en">asBitmap</span>()
             .<span class="pl-en">into</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-c">//Bitmap b = BitmapFactory.decodeResource(mContext.getResources(), mResIds.get(0));</span>
                         <span class="pl-s1">filterSourceTexture2</span> = <span class="pl-smi">OpenGlUtils</span>.<span class="pl-en">loadTexture</span>(<span class="pl-s1">resource</span>, <span class="pl-smi">OpenGlUtils</span>.<span class="pl-c1">NO_TEXTURE</span>, <span class="pl-c1">true</span>);
                     }
             });
    }
});</pre></div>
<p dir="auto">The Exception I am getting is "It should be called on main thread"</p>
<p dir="auto">how to fix it?</p>
<p dir="auto">It is interesting to see how some applications like A+Gallery or QuickPic show images loaded into the disk cache very fast and smooth.<br>
Imagine I have 1000 images.<br>
They are shown inside a ListView or RecyclerView.<br>
About 20 to 50 images gonna appear on the screen.<br>
On scroll I get to the images that are not inside memory cache anymore because memory cache is now filled with scrolled images.<br>
So memory cache is limited and it could be customized but carefully which is not my concern now.<br>
What I noticed about A+Gallery and QuickPic is that they show images like they are available inside memory cache which is impossible by the size of provided memory cache that these days' devices provide for each application.<br>
So It left me with this idea that these apps loading memory cache from disk cache as soon as ListView or RecyclerView or GridView gets close to the end of the available bitmaps inside memory cache.<br>
Glide loads new images from disk cache if they are not in memory cache, which will happen if users scroll on many images in one direction.<br>
If explained feature is already implemented into the Glide, please help me to know how to load Glide's memory cache from its disk cache to prevent fast scrolling show empty items or placeholders.<br>
And if Glide doesn't have such a feature yet I would like to know your idea about requested feature is it doable or I'm wrong about mentioned apps. Thank you</p>