Show all stored files with given extension

#1

Hello community,

I have nearly finished my first android app using Processing 3 for android. This app uses the command saveStrings(string,filename) to store textfiles with extension .txt wchich works fine. In processing the files appear inside the sketchfolder (not the data folder). In android I do not know where they are.
Now the question is, how to show a list of all files with extension .txt , so that one can load the one we need to work on inside the app. My idea would be to create a rectangle inside which this list should appear. Does anybody know how to manage this?
Thanks a lot for your help, this is would be just the last unsolved piece for my app.

John56

#2

It seems android has an api for listing files: https://developer.android.com/reference/android/content/Context.html#fileList()

You could try filtering the array returned by that command for items that have the .txt extension.

#3

one idea is you fix where they end up:
Using Save() Methods ,
as searching a whole device for all files with a specific ext.
takes long and you would need special privileges to do that.

#4

Tank you for this information. This site seems quite elaborate and difficult to follow for beginners like me. Does there exist any piece of Processing code that does this job? Just listing all .txt files that have been previously stored by the app. Like dir *.txt as we did in DOS years ago… :wink: