Android Question Usb folder path

postasat

Active Member
Licensed User
Longtime User
Hi,
I need to use in my app a folder path located on Usb stick.
Usually, for internal file, I use dialogs library and ShowOnlyFolders to choose the correct folder.

Is the usb main path always the same if I connect different stick ?

How can I open a filedialog with filepath always set to usb "main folder" ?
Is it possible ?

I need to write text file data to specific usb folder (textwriter) folder created if needed, and reload the same text data file from the same usb folder, later.

Thank you.
 
Upvote 0
Hi DonManfred,

the code I was using for internal text file was this:

Code: Copy
'open file data
    TR1.Initialize(File.OpenInput(foldertoload, filetoload))
                
    'read data
    data1 =  TR1.ReadLine
    data2 =  TR1.ReadLine
    data3 =  TR1.ReadLine
    data4 =  TR1.ReadLine
    data5 =  TR1.ReadLine

    listafile = TR1.ReadList
        TR1.Close

How can I modify it to use with externalstorageclass ?

Thank you.
 
Upvote 0
Accessing the USB storage is a bit more complicated. Start with running the example and being able to access the USB storage.

The next step is to call FindFile to get an ExternalFile that points to the relevant file, and call OpenInputStream to open the stream. From that point the code is identical to your code.
 
Upvote 0
Back
Top