title: Display video list from specified folder
body: <p>I have tried following code to display video thumbnails in activity from specified folder. The problem is when i debug the app it shows all video paths there but it does not display these.Any suggestions please where i am doing wrong?</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>private void init_phone_video_grid() {
      System.gc();
      String[] proj = { MediaStore.Video.Media._ID,MediaStore.Video.Media.DATA,MediaStore.Video.Media.DISPLAY_NAME,MediaStore.Video.Media.SIZE };
      File file = new File(Environment.getExternalStorageDirectory() + File.separator + "Funtube/UserData/Videos/" + File.separator);
      File[] list = file.listFiles();
          for (File f: list) {
           String name = f.getName();
              if (name.endsWith(".mp4"))
                  count++;
              path = file.getAbsolutePath() + "/" + name;
          }
  
       videocursor = managedQuery(Uri.parse(path), proj, null, null, null);
  
       //videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,proj, null, null, null);
          count = videocursor.getCount();
          videolist = (ListView) findViewById(R.id.PhoneVideoList);
          videolist.setAdapter(new VideoAdapter(getApplicationContext()));
          videolist.setOnItemClickListener(videogridlistener);
      }
  </code></pre>
  
  <p><strong>VideoAdapter</strong></p>
  
  <pre><code>public class VideoAdapter extends BaseAdapter {
          private Context vContext;
  
          public VideoAdapter(Context c) {
              vContext = c;
          }
  
          public int getCount() {
              return count;
          }
  
          public Object getItem(int position) {
              return position;
          }
  
          public long getItemId(int position) {
              return position;
          }
  
          public View getView(int position, View convertView, ViewGroup parent) {
              System.gc();
              ViewHolder holder;
              String id = null;
              convertView = null;
              if (convertView == null) {
                  convertView = LayoutInflater.from(vContext).inflate(
                          R.layout.listitem, parent, false);
                  holder = new ViewHolder();
                  holder.txtTitle = (TextView) convertView
                          .findViewById(R.id.txtTitle);
                  holder.txtSize = (TextView) convertView
                          .findViewById(R.id.txtSize);
                  holder.thumbImage = (ImageView) convertView
                          .findViewById(R.id.imgIcon);
  
                  video_column_index = videocursor
                          .getColumnIndexOrThrow(MediaStore.Video.Media.DISPLAY_NAME);
                  videocursor.moveToPosition(position);
                  id = videocursor.getString(video_column_index);
                  video_column_index = videocursor
                          .getColumnIndexOrThrow(MediaStore.Video.Media.SIZE);
                  videocursor.moveToPosition(position);
                  // id += " Size(KB):" +
                  // videocursor.getString(video_column_index);
                  holder.txtTitle.setText(id);
                  holder.txtSize.setText(" Size(KB):"
                          + videocursor.getString(video_column_index));
  
                  String[] proj = { MediaStore.Video.Media._ID,
                          MediaStore.Video.Media.DISPLAY_NAME,
                          MediaStore.Video.Media.DATA };
                  @SuppressWarnings("deprecation")
                  Cursor cursor = managedQuery(
                          MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj,
                          MediaStore.Video.Media.DISPLAY_NAME + "=?",
                          new String[] { id }, null);
                  cursor.moveToFirst();
                  long ids = cursor.getLong(cursor
                          .getColumnIndex(MediaStore.Video.Media._ID));
  
                  ContentResolver crThumb = getContentResolver();
                  BitmapFactory.Options options = new BitmapFactory.Options();
                  options.inSampleSize = 1;
                  Bitmap curThumb = MediaStore.Video.Thumbnails.getThumbnail(
                          crThumb, ids, MediaStore.Video.Thumbnails.MICRO_KIND,
                          options);
                  holder.thumbImage.setImageBitmap(curThumb);
                  curThumb = null;
  
              } /*
               * else holder = (ViewHolder) convertView.getTag();
               */
              return convertView;
          }
      }
  </code></pre>