I am new to android programming and trying to launch file explorer using SAF to select a folder/directory. Below code works fine when selecting a file, however, I want user to select a folder (and/or create a new folder).
How to get "select" and "new folder" buttons in the file explorer as shown in the attached image?
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
startActivityForResult(Intent.createChooser(intent, "Open folder"), PICK_REQUEST_CODE);
I am new to android programming and trying to launch file explorer using SAF to select a folder/directory.
Your code is not using the Storage Access Framework.
however, I want user to select a folder (and/or create a new folder).
You cannot use ACTION_GET_CONTENT
for that. You would need to use ACTION_OPEN_DOCUMENT_TREE
, and that requires Android 5.0.