Sorry guys,
It looks like a trivial question, but I cannot resolve it... Please help
I have a list view in a simple layout. It is supposed to be populated by values from the database. After looping through the recordset successfully, it does not show in the layout at all as if its visible property is false. Here is the code
B4X:
Dim sf1 As JdbcResultSet = Starter.RemoteSQL1.ExecQuery2("exec up_read_hotel_stay ?,?", Array(Starter.G_Company,Starter.G_PassID))
Dim theStayPeriod As String
Do While sf1.NextRow
theStayPeriod="From " & sf1.GetString("period_start") & " To " & sf1.GetString("period_end")
lstStay.AddTwoLines(sf1.GetString("hotel_name"), theStayPeriod)
Loop
sf1.close
The resultset has 2 records and contains no nulls, and the expression thestayperiod has a value. i tried even to use AddSingleLine method with a hardcoded value... no success... What Am I missing, please help. Thanks
1 - there is a Panel (or other Views) over your ListView
2 - the ListView height is not enough
3 - the Listview is out of screen (log lstStay.Left) (4 - no records have actually been read (add a log command to check the theStayPeriod value))
Thank you guys for the help... Here is what I did:
1- I changed the background color
2- I increased the size (width and height)
3- I even harcoded the value of thestayperiod
4- I did not need to log (lstStay.left) because it is showing visually with the new color)
5- I clicked "Bring to Front" in the designer for the Listview
6- I added the log in the loop. It indicates the correct values as expected (No Nulls)
Attached are 3 files:
1- Screenshot of the designer
2- Screenshot from the Phone
3- Screenshot of the troubled code and the log
It is weird... I must be missing something.. Please help. Thanks
Attached is a summarized project zip file.
To login use any number in the User ID and any name in User Name.
After login, The next page is the troubled one.... Obviously, I removed access to the database... You will see the listview in blue empty. Thank you guys for the help.
You fill the lstStay with 2 items in LoadSummaryInfo:
B4X:
lstStay.AddTwoLines("Sheraton Hotel", theStayPeriod) ' line 487
lstStay.AddTwoLines("Hilton Hotel", theStayPeriod) ' line 492
Then you remove all views from scrollView1, same routine, at line 502.
Line 513 calls ShowSummaryInfo, which again removes all that views and loads a layout, "summaryinfo", which contains lstStay, and now this is empty, obviously.