How to delay Picasso image loading?
<p>I have implemented a shared element activity transition animation between MainActivity (GridView) and DetailActivity. When item is clicked, the image in Grid item will zoom-in to become the background image in DetailActivity. I have made the transition very smooth by saving the image on the MainActivity into a file, then use it as placeholder image in DetailActivity before the higher quality image is downloaded via picasso. When picasso finished its task the higher quality image will replace the placeholder one very neatly.</p>

<p>Code from onCreateView() in DetailActivityFragment.java</p>

<pre><code>ImageView iv = (ImageView) mRootview.findViewById(R.id.movie_poster);
try {
    // Prepare "InterimPoster" jpeg file to be placeholder image
    Bitmap bitmap = BitmapFactory.decodeStream(c.openFileInput("InterimPoster"));
    Picasso.with(c).load("http://image.tmdb.org/t/p/w780" + mMovieInfo[2])
            .placeholder(new BitmapDrawable(getResources(), bitmap))
            .fit()
            .centerCrop()
            .noFade()
            .into(iv);

} catch (FileNotFoundException e) {
    e.printStackTrace();
}
</code></pre>

<p>As for animation, I implement it like in the link here step 1-3 <a href="https://guides.codepath.com/android/Shared-Element-Activity-Transition" rel="nofollow">https://guides.codepath.com/android/Shared-Element-Activity-Transition</a></p>

<p>However, sometimes there's flicker when the higher quality image finished download before the transition animation is completed. The zooming-in image will be replaced with new image while moving which is an unpleasant animation.</p>

<p>So I wonder how can I fix this flicker? One thing I can think of is to delay the image download because I already have lower quality image as a placeholder. How can I do that? </p>

<p><a href="https://www.youtube.com/watch?v=GTH1JIa-3HE" rel="nofollow">Here the video</a>.
Usually, on my test device it's smooth 80% of the time, but luckily in this video it flicker most of the time.</p>