Android Question Use path with file:/// in operation

schimanski

Well-Known Member
Licensed User
Longtime User
I get different pathes from my startingintent with Intent.ExtrasToString like the followings:

B4X:
Path=file:///storage/extSdCard/Download/test.txt
Path=file:///storage/emulated/0/....
Path=file:///storage/sdcard0/....

and it seems, that these pathes are always different on different devices.

Now I want to use the path to work with like file.copy, but the operations doesn't accept a path which begins with file:///

B4X:
File.Copy("", Path, File.DirRootExternal , test.txt)

Is there a solution which works for all pathes?
 

NJDude

Expert
Licensed User
Longtime User
You have to use DirDefaultExternal, DirRootExternal to access those locations, since as you found out those locations vary from device to device, however, you could parse the result and extract the path and file name.
 
Upvote 0
Top