I have an old program with this routine:
Private Sub ListaFiles(Dir As String)
Dim lstFiler As List
Dim strTemp As String
lstFiler = File.ListFiles(Dir)
For i = 0 To lstFiler.Size - 1
strTemp = lstFiler.Get(i)
If strTemp.IndexOf(".") = - 1 Or strTemp.IndexOf(".csv") > 0 Then
lsvFile.AddSingleLine(strTemp)
End If
Next
End Sub
When I try to use it in a B4X module I get an error on this row:
For i = 0 To lstFiler.Size - 1
error: java.lang.RuntimeException: Object should first be initialized (List).
I have try to put in lstFiler.Initialize before lstFiler = File.ListFiles(Dir) but it is the same error. How shall I do to get it work in a B4X module?
Private Sub ListaFiles(Dir As String)
Dim lstFiler As List
Dim strTemp As String
lstFiler = File.ListFiles(Dir)
For i = 0 To lstFiler.Size - 1
strTemp = lstFiler.Get(i)
If strTemp.IndexOf(".") = - 1 Or strTemp.IndexOf(".csv") > 0 Then
lsvFile.AddSingleLine(strTemp)
End If
Next
End Sub
When I try to use it in a B4X module I get an error on this row:
For i = 0 To lstFiler.Size - 1
error: java.lang.RuntimeException: Object should first be initialized (List).
I have try to put in lstFiler.Initialize before lstFiler = File.ListFiles(Dir) but it is the same error. How shall I do to get it work in a B4X module?