yaniv hanya Active Member Licensed User Aug 14, 2019 #1 based on the ExternalStorage class from here https://www.b4x.com/android/forum/t...access-sd-cards-and-usb-sticks.90238/#content is there a way to get the parent folder from an ExternalFile?
based on the ExternalStorage class from here https://www.b4x.com/android/forum/t...access-sd-cards-and-usb-sticks.90238/#content is there a way to get the parent folder from an ExternalFile?
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2019 #2 Google documentation: https://developer.android.com/reference/android/support/v4/provider/DocumentFile A single document may appear as the child of multiple directories, so it doesn't inherently know who its parent is. That is, documents don't have a strong notion of path. You can easily traverse a tree of documents from parent to child, but not from child to parent. And see this: https://developer.android.com/refer...v4/provider/DocumentFile.html#getParentFile() The external storage does include a "parent" feature that is based on the stack of folders. You can do something similar in your app. If you are looking for a way to get the parent folder of the folder the user chose then it is not possible. Upvote 0
Google documentation: https://developer.android.com/reference/android/support/v4/provider/DocumentFile A single document may appear as the child of multiple directories, so it doesn't inherently know who its parent is. That is, documents don't have a strong notion of path. You can easily traverse a tree of documents from parent to child, but not from child to parent. And see this: https://developer.android.com/refer...v4/provider/DocumentFile.html#getParentFile() The external storage does include a "parent" feature that is based on the stack of folders. You can do something similar in your app. If you are looking for a way to get the parent folder of the folder the user chose then it is not possible.
yaniv hanya Active Member Licensed User Aug 15, 2019 #3 what I need to do is find the return path only to the directory that the user has chosen not beyond that. Upvote 0
what I need to do is find the return path only to the directory that the user has chosen not beyond that.
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2019 #4 There is no such thing. You only get a uri (stored in Root) and you can get the files and folders in that root folder. The uri might include and might not include the actual path of the file system. Last edited: Aug 15, 2019 Upvote 0
There is no such thing. You only get a uri (stored in Root) and you can get the files and folders in that root folder. The uri might include and might not include the actual path of the file system.