einUsername
einUsername

Reputation: 1619

Open file from specific folder with Intent.ACTION_OPEN_DOCUMENT

I would like to open the file picker at a specific path. The user should be able to pick any file on the phone, but the SAF should show a specific folder first. I tried the following but it always opens the downloads folder. Thanks!

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); 
intent.addCategory(Intent.CATEGORY_OPENABLE);
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath());
intent.setDataAndType(uri,"image/*");

startActivityForResult(intent, 1);

Upvotes: 1

Views: 1072

Answers (1)

greywolf82
greywolf82

Reputation: 22173

you need to use the extra EXTRA_INITIAL_URI

Upvotes: 1

Related Questions