Is it possible to specify an "start path" when using Intent.ACTION_OPEN_DOCUMENT_TREE
?
When I use it like this:
Intent chooseFolderIntent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(Intent.createChooser(chooseFolderIntent, getString(R.string.save_to_directory)), CHOOSE_FOLDER_CODE);
It starts displaying all the folders from the root of the phone. But I would like it to start displaying a certain path (eg. DCIM folder)
Is there any extras I can use to specify this?
On API 26+, you can use DocumentsContract.EXTRA_INITIAL_URI to set the initial directory for the ACTION_OPEN_DOCUMENT_TREE
Intent. Note that the URI must be one retrieved from the Storage Access Framework APIs (i.e., it must be a document tree URI).
There's no way to do this pre-API 26.
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