How to open a dialog that list all applications that can open a given folder?
I tried following code
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setData(Uri.fromFile(Environment.getExternalStorageDirectory()));
startActivity(Intent.createChooser(intent, "Open Folder"));
it says "No applications can perform this action."
My device has default File Explorer and AndroidZip applications (these apps can open a folder).
it says "No applications can perform this action."
That is not surprising. You are not asking to open a "folder", as there is no such thing as a "folder" in the Intent
system. You are trying to find out what applications can open a path with no file extension and no MIME type. There are no applications installed on your device that have an <intent-filter>
on an activity that supports ACTION_GET_CONTENT
on a path with no file extension and no MIME type.
You might try ACTION_VIEW
. However, bear in mind that I would estimate that 90+% of Android devices will have nothing that deals with "folders" in this fashion, either.
Try this here. Works for me.
public void openFolder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ "/yourFolder/");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));
}
See also here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With