Skip to content Skip to sidebar Skip to footer

Sd-card Access Api Android For Lollipop?

In this other question How to use the new SD card access API presented for Android 5.0 (Lollipop)? It is explained how to use the new API to access the 'external SDCard'. But, how

Solution 1:

You can't get the absolute path because the Documents API is designed to abstract this from you.

However, the treeUri does contain the relative path to the file. Try examining the Uri using Uri#getPathSegments()

Solution 2:

Use

FileUtil.getFullPathFromTreeUri(treeUri, this)

from

https://github.com/jeisfeld/Augendiagnose/blob/f24ddd7d3da4df94552ca0a9e658399602855a67/AugendiagnoseIdea/augendiagnoseLib/src/main/java/de/jeisfeld/augendiagnoselib/util/imagefile/FileUtil.java

to get the full path. Seperate the path using

finalString[] seperated = treeUri.toString().split("\\/");

to get the current dir name.

Post a Comment for "Sd-card Access Api Android For Lollipop?"