title: Android Gif animation slow animate rate
body: <blockquote>
    <p>Hi all i have a requirement in  my project.</p>
    
    <p>i need to show a gif file after completing of that gif animation i need to show other gif file</p>
    
    <p>ex:  <strong>my first gif animation time is 10second so after completing 10 second i need to play other gif with 5seconds and so on</strong>.</p>
    
    <p>I am able to get gif animation time but gif rendering took to much time to play gif if my gif animation time is 10sec then it took around 15-20sec to 
    play entire gif</p>
    
    <p>I am using <strong>Glide</strong> Library</p>
    
    <p>i get gif duration from getGifDurationTime and after that onResourceReady i scheduled a runnable to finishTime 
            but my runnable execute before gif animate finish complete.actually runnable is execute at right time but system play gif very slow rate</p>
  </blockquote>
  
  <pre><code>public static int getGifDurationTime(File file){
      InputStream is = null;
      try {
          is = new FileInputStream(file);
          Movie movie = Movie.decodeStream(is);
          int duration = movie.duration();
          return duration;
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      }
      Movie movie = Movie.decodeStream(is);
      int duration = movie.duration();
      return 0;
  }
  
  Runnable runnable = new Runnable() {
      @Override
      public void run() {
        //code to show next gif  
      }
  };
  
  File file = new File(android.os.Environment.getExternalStorageDirectory(), GiftManager.FOLDER_NAME+"/"+fileName);
  int finishTime = getGifDurationTime(file);
  
  GlideDrawableImageViewTarget imageViewTarget = new GlideDrawableImageViewTarget(giftImageView) {
      @Override
      public void onResourceReady(GlideDrawable resource, GlideAnimation&lt;? super GlideDrawable&gt; animation) {
          super.onResourceReady(resource, animation);
          handler.postDelayed(runnable, finishTime);
      }
  
      @Override
      public void onLoadFailed(Exception e, Drawable errorDrawable) {
          super.onLoadFailed(e, errorDrawable);
      }
  };
  
  Glide.with(context).load(file).into(imageViewTarget);
  </code></pre>