hi,
I have made a layout in the Designer and am trying to put values into a list that is in the designer and is called StationList (type is listview). However, if I'm using the code below, I get a view doesn't exit error.
What am I doing wrong?
Also I'll probably have another query related to using an autocomplete box and shrinking down the list according to what's typed in the box once this gets sorted
Thanks!
I have made a layout in the Designer and am trying to put values into a list that is in the designer and is called StationList (type is listview). However, if I'm using the code below, I get a view doesn't exit error.
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim StationList As ListView
Dim StationCount As Int
Dim i As Int
Dim dir As String
dir = CopyDBFromAssets("lineinfo.db")
SQL1.Initialize(dir,"lineinfo.db",True)
StationList.Initialize("StationList")
StationList.SingleLineLayout.Label.TextColor = Colors.Black
Activity.Color = Colors.white
Activity.LoadLayout("StationFreeSearch") 'this is the layout where the list is
StationCount = SQL1.ExecQuerySingleResult("SELECT count(DISTINCT StationName) FROM lineinfo")
For i = 1 To StationCount
StationList.AddSingleLine(SQL1.ExecQuerySingleResult("SELECT DISTINCT StationName FROM lineinfo WHERE StationAlphaID = " & i )) 'the query is okay in terms of there are no errors in the sql part, but the list remains completely empty.
Next
Activity.LoadLayout("StationFreeSearch")
'Activity.AddView(StationList, 0, 0, 100%x, 100%y) /* im not using these because this doesnt actually utilise the layout. */
'Activity.AddView(Searchbox, 0, 0, 300dip, 100dip) /* ignore this for now */
End Sub
What am I doing wrong?
Also I'll probably have another query related to using an autocomplete box and shrinking down the list according to what's typed in the box once this gets sorted
Thanks!