title: Android duplicate thumbnail issue
body: <p>I am creating a custom image and video gallery just like Whatsapp have to allow user to select multiple image/video,so far i am populating and showing thumbnails on gridview.But the result is,on some devices the images sometimes got shown duplicated and on some they do not.same happens with video gallery also.</p>
  
  <p>I am quering the ID of Images from </p>
  
  <pre><code> MediaStore.images 
  </code></pre>
  
  <p>and get thumbnails using </p>
  
  <pre><code>MediaStore.images.thumbnails.getThumbnail 
  </code></pre>
  
  <p>from obtained IDs </p>
  
  <p>below is my code</p>
  
  <pre><code>            final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
              final String orderBy = MediaStore.Images.Media.DATE_ADDED;
              imageCursor = activity.managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,null, orderBy+" DESC");
              int image_column_index = imageCursor.getColumnIndex(MediaStore.Images.Media._ID);
              int count = imageCursor.getCount();
              thumbnails = new Bitmap[count];
              arrPath = new String[count];
              Log.d("count ", ""+count);
              int i=0;
  
  
              for ( i= 0; i &lt;count; i++) 
              {
                  imageCursor.moveToPosition(i);
                  int id = imageCursor.getInt(image_column_index);
                  int dataColumnIndex = imageCursor.getColumnIndex(MediaStore.Images.Media._ID);
                  thumbnails[i] = MediaStore.Images.Thumbnails.getThumbnail(context.getContentResolver(), id,MediaStore.Images.Thumbnails.MICRO_KIND, null);
                  arrPath[i]= imageCursor.getString(dataColumnIndex);
              }
  </code></pre>
  
  <p>from <a href="http://developer.android.com/reference/android/provider/MediaStore.Images.Thumbnails.html" rel="nofollow noreferrer">android documentation</a> getThumbnail should create thumbnail if it is not available.</p>
  
  <p>one example that produce same issue is <a href="https://stackoverflow.com/questions/13651871/mediastore-images-thumbnails-getthumbnail-returns-wrong-thumbnail-instead-of-nul">MediaStore.Images.Thumbnails.getThumbnail returns wrong thumbnail instead of NULL</a> but that guy hasn't found the solution (question was asked 2 years ago).</p>
  
  <p>Has anybody faced this problem,i have gone through many examples and to add more i am loading cursor in asynctask so populating thubnails should not be a problem for Adroid OS i guess.Is there a solution available for this issue?Its quite frustrating.</p>