<p dir="auto">I encountered problem when using CircleImageView (<a href="https://github.com/hdodenhof/CircleImageView">https://github.com/hdodenhof/CircleImageView</a>). It also happens using CircularImageView (<a href="https://github.com/Pkmmte/CircularImageView">https://github.com/Pkmmte/CircularImageView</a>).</p>
<p dir="auto">When image is loaded from memory everything works fine but when loading from disk cache CircleImageView shows placeholder image. When using RequestListener method onResourceReady is properly called but placeholder image stays.<br>
If no placeholder is set image is loaded properly.</p>
<p dir="auto">Glide version: 3.6.1<br>
Tested on Android 4.4 and 5.0</p>
<p dir="auto">My activity has a <code class="notranslate">ViewPager</code>. This <code class="notranslate">ViewPager</code>'s adapter will load a layout that contains an <code class="notranslate">ImageView</code></p>
<p dir="auto">The adapter overrides the method:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override
public Object instantiateItem(ViewGroup container, int position) {
    Context context = container.getContext();
    View view;
    LayoutInflater layoutInflater = LayoutInflater.from(context);

    view = layoutInflater.inflate(R.layout.image_view_tab, container, false);
    com.pkmmte.view.CircularImageView imageView = (com.pkmmte.view.CircularImageView) view.findViewById(R.id.circularImageView);

    Glide.with(context)
            .load(imageURL) // This is a valid URL
            .placeholder(context.getResources().getDrawable(R.drawable.placeholder))
            .into(imageView);


    container.addView(view);

    return view;
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span>
<span class="pl-k">public</span> <span class="pl-smi">Object</span> <span class="pl-s1">instantiateItem</span>(<span class="pl-smi">ViewGroup</span> <span class="pl-s1">container</span>, <span class="pl-smi">int</span> <span class="pl-s1">position</span>) {
    <span class="pl-smi">Context</span> <span class="pl-s1">context</span> = <span class="pl-s1">container</span>.<span class="pl-en">getContext</span>();
    <span class="pl-smi">View</span> <span class="pl-s1">view</span>;
    <span class="pl-smi">LayoutInflater</span> <span class="pl-s1">layoutInflater</span> = <span class="pl-smi">LayoutInflater</span>.<span class="pl-en">from</span>(<span class="pl-s1">context</span>);

    <span class="pl-s1">view</span> = <span class="pl-s1">layoutInflater</span>.<span class="pl-en">inflate</span>(<span class="pl-smi">R</span>.<span class="pl-s1">layout</span>.<span class="pl-s1">image_view_tab</span>, <span class="pl-s1">container</span>, <span class="pl-c1">false</span>);
    <span class="pl-smi">com</span>.<span class="pl-smi">pkmmte</span>.<span class="pl-smi">view</span>.<span class="pl-smi">CircularImageView</span> <span class="pl-s1">imageView</span> = (<span class="pl-smi">com</span>.<span class="pl-smi">pkmmte</span>.<span class="pl-smi">view</span>.<span class="pl-smi">CircularImageView</span>) <span class="pl-s1">view</span>.<span class="pl-en">findViewById</span>(<span class="pl-smi">R</span>.<span class="pl-s1">id</span>.<span class="pl-s1">circularImageView</span>);

    <span class="pl-smi">Glide</span>.<span class="pl-en">with</span>(<span class="pl-s1">context</span>)
            .<span class="pl-en">load</span>(<span class="pl-s1">imageURL</span>) <span class="pl-c">// This is a valid URL</span>
            .<span class="pl-en">placeholder</span>(<span class="pl-s1">context</span>.<span class="pl-en">getResources</span>().<span class="pl-en">getDrawable</span>(<span class="pl-smi">R</span>.<span class="pl-s1">drawable</span>.<span class="pl-s1">placeholder</span>))
            .<span class="pl-en">into</span>(<span class="pl-s1">imageView</span>);


    <span class="pl-s1">container</span>.<span class="pl-en">addView</span>(<span class="pl-s1">view</span>);

    <span class="pl-k">return</span> <span class="pl-s1">view</span>;
}</pre></div>
<p dir="auto">The problem is that the placeholder is not replaced after the image is loaded. If I switch to another tab in the <code class="notranslate">ViewPager</code> and then switch back, there are two behaviors:</p>
<ul dir="auto">
<li>If the other tab is immediate next to the tab containing the <code class="notranslate">ImageView</code> (either left or right), the placeholder will still not be replaced with the image;</li>
<li>If there is at least one tab between the <code class="notranslate">ImageView</code> tab and the second tab I click, then the image will be replaced correctly.</li>
</ul>
<p dir="auto">Is anyone able to reproduce this? Am I using the right context instance?</p>
<p dir="auto">On a second issue, if I decide not to set the placeholder, I can open this activity, but when I press the back button, I get an error <code class="notranslate">Unable to destroy activity</code>.</p>
<p dir="auto">Both these issues only seem to happen when I use the <code class="notranslate">ViewPager</code>.</p>