Parse folder to create dynamic list of filenames

344 views
Skip to first unread message

Ewan Stevenson

unread,
Feb 11, 2015, 2:06:34 AM2/11/15
to mitappinv...@googlegroups.com
Hi. I'm wanting to create a soundboard app for playing sound effects in our drama class. When the app starts, I'd like it to parse a folder on the SD card to create a list of the filenames in there and, hopefully, dynamically create a button for each of these files in order to play them.

I know that I could easily so this manually but, ideally, I don't want to have to recompile the app each time I want to add a new sound effect.

Is this something that I could do in App Inventor 2?

Taifun

unread,
Feb 11, 2015, 2:16:28 PM2/11/15
to
App Inventor does not offer a feature to get a list of filenames of a directory

a workaround is to call a terminal emulator app using the activity starter and store the result in a file, then read the file using the file component
the statement to execute could be something like this (assuming you want to list all files in directory /mnt/sdcard/Music including all subdirectories)

ls -R /mnt/sdcard/Music > /mnt/sdcard/myResult.txt && exit

Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Reply all
Reply to author
Forward
0 new messages