5

I have exactly the same problem like in this question: How to hint content manager chooser to open directly on a selectable position with ACTION_OPEN_DOCUMENT_TREE And there is no answer there.

This is my code:

Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, 43);

On Android 10 emulator it worked perfectly - it showed the button "USE THIS FOLDER". But now i've reinstalled Android Studio and on Android 11 emulator it doesn't work - you must go to another folder and then return to the current one - only after that the button "USE THIS FOLDER" appears.

  1. folder chooser appears at folder "/storage/0F0F-2B1E/_Temp/2005" - there is no button "USE THIS FOLDER": https://live.staticflickr.com/65535/51062052026_10183b6569_b.jpg

  2. i go to parent folder "/storage/0F0F-2B1E/_Temp" - the button appears: https://live.staticflickr.com/65535/51062135572_6af2e01e2d_b.jpg

  3. i go back to "/storage/0F0F-2B1E/_Temp/2005" - the button is here and is selectable: https://live.staticflickr.com/65535/51062135552_36e318ee19_b.jpg

Serg S
  • 51
  • 4
  • That is a change in how storage works on Android 11: https://developer.android.com/about/versions/11/privacy/storage#file-directory-restrictions – CommonsWare Feb 01 '21 at 13:18
  • `and then return to the current one - only after that the button "USE THIS FOLDER" appears` No. Not if you come back in the root of primary partion or removable micro sd card. They are never selectable. – blackapps Feb 01 '21 at 13:22
  • @CommonsWare, i added screenshots - what can you say about them? – Serg S Feb 02 '21 at 08:21
  • @blackapps, i added screenshots - what can you say about them? – Serg S Feb 02 '21 at 08:21
  • As you did not comment or confirm my remark then what do you expect from me? – blackapps Feb 02 '21 at 08:34
  • If you feel that there is a bug in the documents UI, create a project that reproduces the problem and file a bug report. Perhaps it will get fixed as part of Android 12. – CommonsWare Feb 02 '21 at 12:23
  • Serg S, did you ever get this working? Any solutions or work-arounds will be appreciated. Thank you. @blackapps, this happens to me even if it is not a root folder. If I select any folder and choose "USE THIS FOLDER", then close the app and reopen the app, the chooser will go to the previously chosen folder automatically and it will not show the "USE THIS FOLDER" button. If I then navigate to any folder and back to the original folder, the "USE THIS FOLDER" button will be available and work as expected. Any thoughts will be appreciated. – Samko Mar 03 '21 at 02:59
  • 1
    @Samko, i didn't get this working and don't know any solution. May be as CommonsWare wrote they probably will fix this problem in next versions of Android. – Serg S Mar 04 '21 at 19:58

0 Answers0