I want to open a particular directory (in a file explorer app) where images saved by my app are stored. I can get the Uri of that directory by Uri.parse(imagesDir.getAbsolutePath())
. I tried this, this and others but it just does nothing. This is how my code looks as of now:
Uri selectedUri = Uri.parse(imagesDir.getAbsolutePath());
int OPEN_REQUEST = 1337;
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setDataAndType(selectedUri, DocumentsContract.Document.MIME_TYPE_DIR);
if (intent.resolveActivityInfo(getPackageManager(), 0) != null) {
startActivityForResult(intent, OPEN_REQUEST);
} else {
Log.e("MainActivity", "Could not launch intent");
}
P.S: The value of imagesDir.getAbsolutePath()
= /storage/emulated/0/Draw Easy