title: Prefetching images in fresco
body: <p>am developing an app that prefetch the list of images before scrolling occurs in recyclerview. I tried using prefetchToBitmapCache as suggested. But its not working out. Please suggest me what is going wrong in the below code.
  How it loads the images in prior before set to the adapter.</p>
  
  <pre><code>  private void prepareMovieData() {
  
      Movie movie = new Movie("https://i.pinimg.com/736x/97/5d/42/975d42c0fded9edfbd7aace45a52534e--crossover-cartoons.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/736x/57/2d/a4/572da4b27e9e41bca5f74a5a7358f965--iphone-wallpaper-wallpaper-doraemon.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/e3/16/9b/e3169b4d7baa13739c0e3fa00b493562.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/94/9f/ee/949fee0b6e6fae851fa0e3a062c7c506.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/5a/b9/91/5ab9913ab76af885faecb02d21423a6e.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/736x/d0/20/20/d020203c6485fa0a03509b9a2ad6e051--comic-movies-comic-books.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/9f/c1/f9/9fc1f96aebd1357049e64cb84266c065.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/4a/86/50/4a865068fa0a4780e7725088331079aa.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/7a/1d/52/7a1d52974db26b9aec65d33123751e7d.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      movie = new Movie("https://i.pinimg.com/originals/f9/b3/93/f9b393df3acfde39504d20045c085f60.jpg", "Animation, Kids &amp; Family");
      movieList.add(movie);
  
      new DoPrefetchTask().execute();
  }
  </code></pre>
  
  <blockquote>
    <p>DoPrefetchTask </p>
  </blockquote>
  
  <pre><code>public class DoPrefetchTask extends AsyncTask&lt;String, Void, String&gt; {
      ProgressDialog ceProgressDialogs;
  
      DoPrefetchTask() {
          ceProgressDialogs = new ProgressDialog(MainActivity.this);
      }
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          ceProgressDialogs.show();
      }
  
      @Override
      protected String doInBackground(String... params) {
          try {
              ImagePipeline imagePipeline = Fresco.getImagePipeline();
              for (Movie uri : movieList) {                    imagePipeline.prefetchToBitmapCache(ImageRequest.fromUri(uri.img), null);
              }
          } catch (Exception e) {
              android.util.Log.d("Error Gracevenkat 123", "" + e.toString());
          }
          return null;
      }
      @Override
      protected void onPostExecute(String result) {
  
          if (MainActivity.this != null &amp;&amp; !isFinishing() &amp;&amp; ceProgressDialogs != null) {
              ceProgressDialogs.dismiss();
              mAdapter.update(movieList);
  
          }
      }
  }
  </code></pre>
  
  <blockquote>
    <p>My Adapter onBindViewHolder:</p>
  </blockquote>
  
  <pre><code>  @Override
  public void onBindViewHolder(MyViewHolder holder, int position) {
      Movie movie = moviesList.get(position);
      holder.title.setText(movie.txt);
  holder.imageView.setImageURI(Uri.parse(movie.img));
  </code></pre>
  
  <p>}</p>