title: How to filter out unwanted files using Intent.ACTION_GET_CONTENT
body: <p>I'm using intent.ACTION_GET_CONTENT to allow a user to select images or video files only. this is the way am preparing my intent</p>
  
  <pre><code> Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
   intent.setType("image/* | video/*");
   intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
   intent.addCategory(Intent.CATEGORY_OPENABLE);
   XActivity.startActivityForResult(intent, ACQUIRE_IMAGE_AND_VIDEOS_CODE);
  </code></pre>
  
  <p>When i click the button that start this intent, the following apps are display in my customized dialog</p>
  
  <p><a href="https://i.stack.imgur.com/jxk5W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jxk5W.png" alt="app dialog"></a></p>
  
  <p>below is the method that fills my dialog with apps that can handle the above intent and also what happens when one clicks any app in the dialog</p>
  
  <pre><code>private void inflateDialog(List&lt;ResolveInfo&gt; intents){
  
  ListView lv = (ListView) dialog.findViewById(R.id.listView1);
  
  Collections.sort(intents,
          new ResolveInfo.DisplayNameComparator(packageManager));
  
  appAdapter = new AppAdapter(packageManager, intents);
  
  lv.setAdapter(appAdapter);
  lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
      @Override
      public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int position,
                              long arg3) {
          // TODO Auto-generated method stub
          ResolveInfo launchable = appAdapter.getItem(position);
          ActivityInfo activity = launchable.activityInfo;
          ComponentName name = new ComponentName(activity.applicationInfo.packageName,
                  activity.name);
          IntentFilter filter = launchable.filter;
  
          Iterator&lt;String&gt; actions = filter.actionsIterator();
  
          Intent intent;
  
              if (filter.hasAction(Intent.ACTION_GET_CONTENT)) {
                  intent = new Intent(Intent.ACTION_GET_CONTENT);
                  intent.setType("image/* | video/*");
                  intent.setComponent(name);
                  intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
                  intent.addCategory(Intent.CATEGORY_OPENABLE);
                  xActivity.startActivityForResult(intent, ACQUIRE_IMAGE_AND_VIDEOS_REQUEST_CODE);
                  dialog.dismiss();
              }
  });
  dialog.show();
  
  }
  </code></pre>
  
  <p>When i click on galley app,i can see images and videos and select any. <strong>AT the same time,</strong> i receive a Toast telling me <strong>0 images/videos available</strong>.</p>
  
  <p>When i click file manager and google drive, am presented with all files. <strong>there is no filtering of images and videos that is taking place</strong>. </p>
  
  <p><strong>QUESTIONS</strong></p>
  
  <ul>
  <li><p>How can i force filtering of images and videos in file manager and google drive apps?</p></li>
  <li><p>Why am i receiving the toast <strong>0 images/videos available</strong> on galley even though i can select images and videos?</p></li>
  </ul>