I have built the following sub that loads a CSV file selected by the user. What's the actual pattern for this functionality?
B4X:
Sub btn_LoadRecipients_Click
Dim fc As FileChooser
Dim fn As String
fc.Initialize
fc.Title = "Select Recipients File"
fc.SetExtensionFilter("CSV Files",Array As String("*.csv"))
fn = fc.ShowOpen(B4XPages.GetNativeParent(Me))
If fn <> "" Then
Dim csv As CSVParser
Dim isFirst As Boolean = True
csv.Initialize
Dim table As List = csv.Parse(File.ReadString(File.GetFileParent(fn),File.GetName(fn)),",",False)
For Each row() As String In table
'work with row
If isFirst Then
listHeaders = row
isFirst = False
Else
'add to list_Recipients (B4XView/ListView)
End If
' Log(row(0))
Next
End If
End Sub