Displaying filenames belonging to an Android folder

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Displaying filenames belonging to an Android folder

Post by jim1001 » Mon Mar 21, 2016 1:52 am

Running LiveCode Community 7.1.3 & deploying to an Android tablet

I have a simple test stack running on an Android tablet which should display all files in a named folder which is typed into a field. It works when I type some folders into the field e.g. “/system”, “/dev”, “/system/bin” but I can’t get it to list files living in folders under “/sdcard”, e.g. “/sdcard/DCIM/Camera”. I've tried various alternatives for specifying the path (e.g. "/mnt/sdcard/DCIM/Camera", "/storage/sdcard0/DCIM/Camera") but none have worked up to now.

Here are the 2 lines of code where the folder is typed into folderField & the result (list of files) goes into filesField:

Code: Select all

set the defaultFolder to field "folderField"
put the files into field "filesField"
Any help appreciated.

Thanks,
Jim

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Displaying filenames belonging to an Android folder

Post by SparkOut » Mon Mar 21, 2016 8:47 am

First guess - have you confirmed the standalone settings for external storage is checked?

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Displaying filenames belonging to an Android folder

Post by jim1001 » Mon Mar 21, 2016 11:47 am

SparkOut,

Thanks for your message. I was ready to dismiss your suggestion because
1) the setting is "Write External Storage" and I wasn't writing, only reading
2) the folder /sdcard, despite the name, refers to internal storage - I haven't attached an external sdcard

Anyway, before replying I thought I'd try it anyway and... it worked!

Do you know where the best explanation of Standalone Application Settings for Android is? I checked the LiveCode User Guide but couldn't find any reference to "Write External Storage".

Many thanks for your help & getting me out of a hole!
Jim

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Displaying filenames belonging to an Android folder

Post by SparkOut » Mon Mar 21, 2016 4:17 pm

Well as far as I understand, storage paths in Android are non standard across versions and manufacturers, with just a little consistency in some convensions. My best handle on it has come from maxV here on the forums. He has linked some Google documentation which shows how difficult it is to be clear. A search for his posts in connection with sdcard would be best, unless he might be able to give a more direct reply now.

jim1001
Posts: 143
Joined: Fri Jan 29, 2016 6:25 pm

Re: Displaying filenames belonging to an Android folder

Post by jim1001 » Mon Mar 21, 2016 10:55 pm

OK SparkOut, I'll have a search of the posts as you suggest.

Thanks again,
Jim

Post Reply