title: Video Thumbnail loading slow in android
body: <p>Hi here I create an app for video play. In which I use gridview for Video which contain thumbnail and title of video.
  But it takes too much time for load and when it loaded in gridview it also problem with swipe(slow).
  Here is my code</p>
  
  <blockquote>
    <p>MainActivity</p>
  </blockquote>
  
  <pre><code>public class MainActivity extends Activity {
  ArrayList&lt;AllVideoModel&gt; allVideoList;
  AllVideoListAdapter adapter;
  GridView gridView;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      gridView = (GridView) findViewById(R.id.gridView);
      allVideoList = listVideo(MainActivity.this);
      adapter = new AllVideoListAdapter(MainActivity.this, MainActivity.this, allVideoList);
      gridView.setAdapter(adapter);
  }
  
  public ArrayList&lt;AllVideoModel&gt; listVideo(Context context) {
      ArrayList&lt;AllVideoModel&gt; allVideoModelsList = new ArrayList&lt;&gt;();
      Uri uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
      String[] projection = {MediaStore.Video.VideoColumns.DATA};
      Cursor c = context.getContentResolver().query(uri, projection, null,
              null, null);
      if (c != null) {
          while (c.moveToNext()) {
  
              AllVideoModel model = new AllVideoModel();
              String videoPath = c.getString(0).toString();
              String videoTitle = videoPath.substring(videoPath.lastIndexOf("/") + 1);
              model.setVideoTitle(videoTitle);
              model.setVideoPath(videoPath);
              allVideoModelsList.add(model);
          }
          c.close();
      }
      return allVideoModelsList;
    }
  }
  </code></pre>
  
  <blockquote>
    <p>AllVideoListAdapter</p>
  </blockquote>
  
  <pre><code>public class AllVideoListAdapter extends BaseAdapter {
  Context context;
  ArrayList&lt;AllVideoModel&gt; allVideoModelArrayList;
  LayoutInflater inflater;
  
  public AllVideoListAdapter(Context context, ArrayList&lt;AllVideoModel&gt; allVideoModelArrayList) {
      this.context = context;
      this.allVideoModelArrayList = allVideoModelArrayList;
      inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }
  
  @Override
  public int getCount() {
      return allVideoModelArrayList.size();
  }
  
  @Override
  public Object getItem(int position) {
      return null;
  }
  
  @Override
  public long getItemId(int position) {
      return 0;
  }
  
  private class Holder {
      ImageView image;
      TextView text;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      Holder holder = new Holder();
  
      if (convertView == null) {
          convertView = inflater.inflate(R.layout.grid_layout_video, parent, false);
          holder.image = (ImageView) convertView.findViewById(R.id.image);
          holder.text = (TextView) convertView.findViewById(R.id.text);
          convertView.setTag(holder);
      } else {
          holder = (Holder) convertView.getTag();
      }
      Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(allVideoModelArrayList.get(position).getVideoPath(), MediaStore.Video.Thumbnails.MICRO_KIND);
      holder.image.setImageBitmap(bitmap);
     /* ImageLoader.getInstance().displayImage("", holder.image,
              DisplayImageOption.getDisplayImage(),
              new AnimateFirstDisplayListener());*/
      holder.text.setText(allVideoModelArrayList.get(position).getVideoTitle());
      return convertView;
    }
  }
  </code></pre>
  
  <blockquote>
    <p>AllVideoModel</p>
  </blockquote>
  
  <pre><code>public class AllVideoModel {
  String VideoTitle, VideoPath;
  
  public String getVideoTitle() {
      return VideoTitle;
  }
  
  public void setVideoTitle(String videoTitle) {
      VideoTitle = videoTitle;
  }
  
  public String getVideoPath() {
      return VideoPath;
  }
  
  public void setVideoPath(String videoPath) {
      VideoPath = videoPath;
    }
  }
  </code></pre>
  
  <p>I thought that it should be resolve through cache thumbnail but I can't get it. </p>