Android Question Load Files

Helio

Member
Hello everyone. I would like to load several text file names saved by the project and put one on each label. I searched the forum and found nothing specific. Detail: I'm using an emulator.
 
We don't know how you save the file names, and we don't know how have you created the labels, so we just can guess:

- You can try this sample, changing the swithes for labels, and iterate while you got file names.

- You can add the file names to a xCustomListView
 
Upvote 0
Thanks for answering me. I managed to find a solution. I would like to know now where these files are saved in Windows, but I think that another topic should be created for that. For those who want to know the solution I found, here it goes ... I took it from a LucasMs post and adapted it
Public Sub ListFilesOnly(Dir As String) As List
Dim lstDir, lstRes As List
lstRes.Initialize

If File.Exists(Dir, "") Then

lstDir = File.ListFiles(Dir)

Dim FileName As String

For i = 0 To lstDir.Size - 1
FileName = lstDir.Get(i)
If Not(File.IsDirectory(Dir, FileName)) Then
lstRes.Add(FileName)
End If
Labels(i).Text=FileName
Next
'EditText1.Text=FileName
End If

Return lstRes

End Sub
 
Upvote 0
B4X: Copy
If File.Exists(Dir, "") Then

lstDir = File.ListFiles(Dir)

Dim FileName As String

For i = 0 To lstDir.Size - 1
FileName = lstDir.Get(i)
If Not(File.IsDirectory(Dir, FileName)) Then
lstRes.Add(FileName)
End If
Labels(i).Text=FileName
Next
'EditText1.Text=FileName
End If

Return lstRes

End Sub
 
Upvote 0
Back
Top