Reputation: 80
My code:
Uri selectedUri = Uri.parse("file:///sdcard/Music");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(selectedUri, "*/*");
intent.setType("*/*");
intent.setClassName("com.android.documentsui", "com.android.documentsui.files.FilesActivity");
startActivity(intent);
But its always opens only the Downloads tab, not Music on my sdcard.
Upvotes: 3
Views: 1945
Reputation: 36
Action:
android.intent.action.VIEW
Data:
content://com.android.externalstorage.documents/document/primary%3ADownload%2FMyDir
Mime:
vnd.android.document/directory
Flags:
These don't seem to be critical
This intent will invoke DocumentsUI (and likely other file managers) and if you pick DocumentsUI it will open to the provided path. %3A for the first / and %2F for subsequent / as you nest into the file tree.
Cheers!
Upvotes: 2