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.
To access this File Manager, open Android's Settings app from the app drawer. Tap “Storage & USB” under the Device category. This takes you to Android's storage manager, which helps you free up space on your Android device.
A file manager application can help you organize, store and transfer files on your mobile device. You can choose from several file manager apps for Android or iOS. File manager apps are great for freeing up storage on your mobile device and securely storing important files.
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"));
Actually this days it's more like:
// Construct an intent for opening a folder
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(aDownloadFolder), "resource/folder");
// Check that there is an app activity handling that intent on our system
if (intent.resolveActivityInfo(aContext.getPackageManager(), 0) != null) {
// Yes there is one start it then
startActivity(intent);
} else {
// Did not find any activity capable of handling that intent on our system
// TODO: Display error message or something
}
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