Android Question External storage ... get list of external devices please

blong

Active Member
Licensed User
Longtime User
Erel

External storage class is great BUT I need a different user implementation. Perhaps I am missing something.

Documentation states

1. Call ExternalStorage.SelectDir. This will open a dialog that will allow the user to select the root folder. Once selected the uri of the root folder is stored and can be later used without requiring the user to select the folder again. Even after the device is booted.

I don't really want user having to select an item.

Would it be possible to somehow get a list of the root folders .???

i.e. mylist = ExternalStorage.GetFolders

then I would simply check if folder I need is available and use the CreateFile to place a file there.

In my playing around if I take the USB drive and create a directory on the drive using a Windows PC such as

Android/data/com.myprog.whatever/files

then can save files there no problem. But MakeDir will not create that directory for me.

Your help appreciated.
 

npsonic

Active Member
Licensed User
You can use this

B4X:
File.ListFiles(File.DirDefaultExternal)
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
npsonic .... your suggestion is just the SD card data root.

I need a list of the folders on USB drives when using Erel's ExternalStorage class.

Thx anyway
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Apologies Erel... since you were the author of ExternalStorage then I felt I should ask yourself as I seemed to be suggesting I needed an enhancement of the class.
 
Upvote 0

blong

Active Member
Licensed User
Longtime User
Thanks Erel ... even though it is bad news.

I miss the "good old days" when one could access external media without any problem. My work is mostly on Android media boxes which have lots of USB connections etc and I wish to write files on these USB drives which does NOT seem a big ask IMHO.

You say the "URI is saved"... where is it saved ?

In your example I see the checkbox but not sure how I can browse the 2nd time I run program without selecting it again with the "Pick Folder" button.
??
 
Upvote 0
Top