Skip to content Skip to sidebar Skip to footer

How To Open Default Gallery App With Particular Album Or Folder?

Every example i found on net is opening gallery and get images from gallery as result. My need is i don't want result or images to my app. I just want to trigger gallery app with s

Solution 1:

Try this code. It will retrieve view pictures under storage/emulated/0/Pictures/AppPics You can change the file path according to your directory path.

FilesdDir= Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
Filefile=newFile(sdDir, "AppPics");

if (file.isDirectory()) 
    listFile = file.listFiles();

EDIT: To open your folder using intent

Intentintent=newIntent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.withAppendedPath(Uri.fromFile(file), "/AppPics"), "image/*");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

Solution 2:

You can try like this,

Intentintent=newIntent(Intent.ACTION_VIEW);
Uriuri= [Uri for your folder];
intent.setDataAndType(uri, "image/*");
startActivity(Intent.createChooser(intent, "Open [App] images"));

Post a Comment for "How To Open Default Gallery App With Particular Album Or Folder?"