How to hint content manager chooser to open directly on a selectable position with ACTION_OPEN_DOCUMENT_TREE

筅森魡賤 提交于 2021-02-10 21:20:41

问题


When you use ACTION_OPEN_DOCUMENT_TREEto pick the permission to a path where to store files in Android 11, the default Android content manager by default opens on a recently used path and the button "USE THIS FOLDER" for some reason doesn't even appear at all, even if this path is an accessible path, unless the user manually move through paths to go to a suitable position (or returns in the path opened by default moving through directories if this is a selectable position).

E.g. Assume the latest path used by an user was Documents. When I ask the user to select a path where to allow the app to save the files, with

Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
i.addCategory(Intent.CATEGORY_DEFAULT);

this is what appears:

As you can see there is no "USE THIS FOLDER" blue button.

Now if the user select the superfolder path from here and enter again in Documents this is what He sees:

Now the "USE THIS FOLDER" button is available.

This is totally senseless and it's dreadful for the user experience, and many users certainly end up uninstalling the app bothered and confused.

Am I doing something wrong? Is possible to pass to the intent some hint in order to open the content manager ACTION_OPEN_DOCUMENT_TREE view directly in a specific path available in all Android devices storage (e.g. Documents) with the "USE THIS FOLDER" button available on the opening of the chooser?

来源:https://stackoverflow.com/questions/64031094/how-to-hint-content-manager-chooser-to-open-directly-on-a-selectable-position-wi

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