My application downloads and unpacks a file in a specific folder:
output = new FileOutputStream(realpath, true); output.write(buffer, 0, bytesRead); ZipFile zipFile = new ZipFile(realpath);
With the new intention ACTION_OPEN_DOCUMENT_TREE introduced, I would like to invite the user to select this folder.
When testing the values ββobtained in my onActivityResult, I get Path as /tree/primary:mynewfolder , which is not a physical real path, like / sdcard / mynewfolder.
Uri treeUri = data.getData(); String sPath=treeUri.getPath(); Log.v("Path from Tree ", sPath);
My unpacking method needs a real way:
ZipFile zipFile = new ZipFile(realpath);
How to get the real path, for example / sdcard / mynewfolder, from the provided URI in Lollipop (API 21 and 22)?
android android-5.0-lollipop
mcfly soft Apr 18 '15 at 6:05 2015-04-18 06:05
source share