How can I redirect my app to open the File manager at a specific path ?
I've tried something like:
Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
shareIntent.setType("*/*");
shareIntent.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(new File(filePath)));
shareIntent.setPackage("my.package");
startActivity(shareIntent);
But I keep get the error:
E/AndroidRuntime(3591): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SEND typ=/ flg=0x1 pkg=my.package (has clip) (has extras) }
What is the correct intent filter, as I suspect ACTION_SEND is not the correct one.
Thank you.
You can use Intent.ACTION_GET_CONTENT
:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse("/whatever/path/you/want/"); // a directory
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));