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
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);
When i click the button that start this intent, the following apps are display in my customized dialog
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
private void inflateDialog(List<ResolveInfo> 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<?> 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<String> 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();
}
When i click on galley app,i can see images and videos and select any. AT the same time, i receive a Toast telling me 0 images/videos available.
When i click file manager and google drive, am presented with all files. there is no filtering of images and videos that is taking place.
QUESTIONS
How can i force filtering of images and videos in file manager and google drive apps?
Why am i receiving the toast 0 images/videos available on galley even though i can select images and videos?