Extra to enable the Show/Hide SD Card with Storage Access Framework (SAF)

不问归期 提交于 2019-12-21 02:29:39

问题


I am using the Storage Access Framework (SAF) :

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
startActivityForResult(intent, 0);

I would like to know if there is an extra to enable the Show SD Card option, that user can see in the overflow menu.


回答1:


Add

intent.putExtra("android.content.extra.SHOW_ADVANCED", true);

But be aware that this is not part of the official API. So there is a good chance this will stop working in future Android versions.

The relevant Framework code can be found here: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.0_r1/com/android/documentsui/DocumentsActivity.java#255



来源:https://stackoverflow.com/questions/31322400/extra-to-enable-the-show-hide-sd-card-with-storage-access-framework-saf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!