title: Custom Gallery with Images and Videos in android to select multiple items
body: <p>i want to create a custom gallery to display all images and videos(along with duration) in sdcard. i am using the following code to build a custom gallery</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>final String[] columns = { MediaStore.Images.Media.DATA ,MediaStore.Images.Media._ID};
      final String orderBy = MediaStore.Images.Media.DATE_TAKEN;
      Cursor imagecursor = getContentResolver().query(
              MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,
              null, orderBy + " DESC");
  
      this.imageUrls = new ArrayList&lt;String&gt;();
  
  
      for (int i = 0; i &lt; imagecursor.getCount(); i++) {
          imagecursor.moveToPosition(i);
          int dataColumnIndex = imagecursor.getColumnIndex(MediaStore.Images.Media.DATA);
          imageUrls.add(imagecursor.getString(dataColumnIndex));
  
      }
    String[] parameters = { MediaStore.Video.Media._ID,
                  MediaStore.Video.Media.DATA,
                  MediaStore.Video.Media.DISPLAY_NAME,
                  MediaStore.Video.Media.SIZE, MediaStore.Video.Media.DURATION,
                  MediaStore.Video.Media.DATE_TAKEN,MediaStore.Video.Thumbnails.DATA};
  
  
  
       Cursor   videocursor = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
                  parameters, null, null, null);
  
       for (int i = 0; i &lt; videocursor.getCount(); i++) {
           videocursor.moveToPosition(i);
           imageUrls.add(videocursor.getString(videocursor.getColumnIndex(MediaStore.Video.Thumbnails.DATA)));
              }
      options = new DisplayImageOptions.Builder()
          .showStubImage(R.drawable.stub_image)
          .showImageForEmptyUri(R.drawable.image_for_empty_url)
          .cacheInMemory()
          .cacheOnDisc()
          .build();
  
      imageAdapter = new ImageAdapter(this, imageUrls);
  </code></pre>
  
  <p>from the above code i am able to get the path of the video, how can i get the video thumbnail along with video duration. and represent it in the gallery</p>
  
  <p>if there are any buit in projects for custom gallery with videos and images please post the links
   i actually want to create a custom gallery to select multiple image and video files. i searched a lot in google i am finding the custom image gallery but not with videos please help me in solving this problem.     </p>