[英]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.
用户应该能够选择手机上的任何文件,但 SAF 应该首先显示特定文件夹。 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);
you need to use the extra EXTRA_INITIAL_URI
您需要使用额外的
EXTRA_INITIAL_URI
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.