Android Question List view does not show in the layout

Fayez Boulos

Member
Licensed User
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
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

Fayez Boulos

Member
Licensed User
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
 

Attachments

  • Layout Design_I brought_listview_to_front.jpg
    Layout Design_I brought_listview_to_front.jpg
    207.3 KB · Views: 160
  • Screenshot_20200427-152709.png
    Screenshot_20200427-152709.png
    213.8 KB · Views: 145
  • Code and Log.jpg
    Code and Log.jpg
    337.5 KB · Views: 157
Upvote 0

Fayez Boulos

Member
Licensed User
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.
 

Attachments

  • IssueInvestigation.zip
    211.1 KB · Views: 169
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Comments to the project you attached.

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.
 
Upvote 0
Top