Android Question B4X custom list view force refresh?

Tony Tetley

Member
Licensed User
Longtime User
Trying to get my head into B4Xpages. I have a project that has a custom list view page that is loaded from a SQLlite db. This works as expected.

I have options to show some sub sets of items in the SQLlite db but I cannot get the list to clear and reload. I have a clv.Clear in the B4X_PageAppear sub but this is only called once and never again until the app is closed. Have tried closing the page and tried ShowPageAndRemovePreviousPages when returning to the main page but nothing seems to work. Once a set of db rows are loaded into the list view it becomes static and always displays the intitial set of rows loaded.

I am sure I am missing something simple.
 

toby

Well-Known Member
Licensed User
Longtime User
1. Create a Sub called LoadData and move all code you use to retrieve data from sqlite and populate CLV from P4XPage_Create Sub.
2. Call this Sub whenever you want to refresh CLV data
B4X:
Public Sub LoadData
'1. Get data from sqlite
'''''your code

'2. Populate CLV
'''your code

'3. B4XPage.ShowPage(CurrentPageName)
End Sub
 
Upvote 1

Tony Tetley

Member
Licensed User
Longtime User
1. Create a Sub called LoadData and move all code you use to retrieve data from sqlite and populate CLV from P4XPage_Create Sub.
2. Call this Sub whenever you want to refresh CLV data
B4X:
Public Sub LoadData
'1. Get data from sqlite
'''''your code

'2. Populate CLV
'''your code

'3. B4XPage.ShowPage(CurrentPageName)
End Sub
That solution works. I am beginning to see the advantage of the B4Xpages. It is a learning curve for me but I am getting there.

Thank you for the reply
 
Upvote 0
Top