Displaying file names

I’m developing an app that wants to display a list (ListView) of all the .csv files on the device.
I’m using the FileTools and/or TaifunFiles extension (FileToools1).ListFiles block to get the file names.
When running with the companion, it preforms just fine, but when I create the apk file, the list view is blank. Currently the csv file are copied manually from the computer to the internal storage of the device not an SD card. The Verizon Droid Turbo i’m using doesn’t have an SD card slot.

I’ve tried a variety of options for the file dir. no “/”, one “/”, two “//”, even three “///” using both FileTools or TaifunFiles. All have the same result of a blank ListView from the apk.

Anyone have any ideas why the ListView is blank when operating from the apk version?

What have you done so far, show your (relevant) blocks.

Which, in android/AI2 terms is a virtual SDcard at location:

EDITED:
/sdcard/emulated/0
/storage/emulated/0

You should be able to reference these files with a "/path/to/filename" or a full path
EDITED
file:///sdcard/emulated/0/path/to/filename
file:///storage/emulated/0/path/to/filename

No, this path is not correct: file:///sdcard/emulated/0/

The correct path to the root directory of the External Storage is one of these:

  • file:///mnt/sdcard/
  • file:///storage/emulated/0/
  • /storage/emulated/0/

See also here:

Sorry my mistake…

Btw, I would always prefer this path:
/storage/emulated/0/
among other things - but not least - because of the Refresh.Gallery method (Taifun’s Tools extension), which does not work with:
file:///storage/emulated/0/.

Thank you all, I’m looking at all suggestions and ideas to see what works for my app

With com.KIO4_Termial.aix extesion, you can use ls command to get list of files:

Update, after some trial and error, I find that the “ListView” will function as hoped If the device has given permission to access photos, media and files. So how can I initially get/give that permission (without user interaction)?

Update, files

Text_File_App.aia (43.9 KB)

The user has to give this permission manually. No way around it.

Thanks a bunck

Yes, this should be possible, when App Inventor targets API 29 (Android 10).

See also here:
https://groups.google.com/forum/#!searchin/mitappinventortest/app-specific$20directory|sort:date/mitappinventortest/_iNpeX_3mgg/vHvXpdGyBQAJ

… means, you do not need any permissions (READ_/WRITE_EXTERNAL_STORAGE) to read from / write to the app-specific directory. And App Inventor has to implement that when targeting API 29.

Anke, I appreciate your help and suggestions, I’m trying them out now

2 posts were merged into an existing topic: PDF read error after buiding apk