1

I'm trying to open a specific folder using intent, but the device's recent folder open instead.

Code:

Uri uri = Uri.parse(filepath);
Intent intent = new Intent(Intent.ACTION_GET_CONTENT,uri);
intent.setDataAndType(uri,"text/plain");
StartActivityForResult(intent, REQUEST_CODE);
Geeky bean
  • 475
  • 6
  • 21

1 Answers1

1

ACTION_GET_CONTENT does not take a Uri, so yours is ignored.

With ACTION_OPEN_DOCUMENT, you can use EXTRA_INITIAL_URI to provide some document tree (e.g., from ACTION_OPEN_DOCUMENT_TREE) that should be used as the initial location.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491