0

In my app, I let the user pick a folder to save logs, using Intent.ACTION_OPEN_DOCUMENT_TREE. After the user has selected the folder, a Uri is returned to onActivityResult and is then used with the DocumentFile Content Provider. This part works fine.

However, I would like to display the name of the folder the user has selected (and preferably a path to this folder). The Uri does not show information that could be easily presented to the user.

Is there a way to get folder name and path (need not to be absolute) from the Uri?

Example:

  • User has selected External Storaage > Downloads > MyLogs in the folder picker.

  • Uri, that is returned is something like:

    content://com.android.providers.downloads.documents/tree/msd%3A281448/

  • I would like to display Downloads > MyLogs

  • Does this answer your question? [How to get the Full file path from URI](https://stackoverflow.com/questions/13209494/how-to-get-the-full-file-path-from-uri) – javdromero Aug 02 '21 at 22:25

0 Answers0