I'm using the customListView class to show many items in the list. Everytime when I open an other activity and come back to the main activity, the customlistview loads again and the position on the screen is gone. Is it possible to save this position, so the user don't have to scroll again?
I checked the statemanager module, but I don't get this working for the customlistview. Can the statemanager do this job for me?
It should do .. Add these subs to CustomListView class
B4X:
Public Sub GetScrollPosition As Int 'get current scroll position
Return sv.ScrollPosition
End Sub
Public Sub ScrollToPosition(Position As Int) 'immediately scroll to new position
sv.ScrollToNow(Position)
'DoEvents should not be neccessary ....
End Sub
Then when you leave main activity run below code ... and store this in Global Var or StateManager.
B4X:
iScrollPos = CLV1.GetScrollPosition
When you return to main activity reset the scroll position with ...