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