Saving state of a listview?

Ricky D

Well-Known Member
Licensed User
Longtime User
I have a listview on one of my activities and I'd like to save it's state when the activity pauses.

I can use

B4X:
StateManager.SetSetting("lvaddmenuitems", lvAddMenuItems)

to save the listview but how do I retrieve it?

this

B4X:
      If StateManager.GetSetting("lvaddmenuitems")<>"" Then lvAddMenuItems = StateManager.GetSetting("lvaddmenuitems")

causes a compile error of incompatible types - string and listview.

How can I persist a listview? This code is used for when the activity is paused and restarted like when orientation changes.

I'm puzzled.

regards, Ricky
 

Ricky D

Well-Known Member
Licensed User
Longtime User
@eps I'm using statemanager and it doesn't handle listviews

@margret I'm using single line

regards, Ricky
 
Upvote 0

MiniDemonic

Member
Licensed User
Longtime User
Wouldn't it be possible for you to use files for the listviews?
File.WriteList and File.SaveList are great for saving lists. You can save them to files names temp1.txt, temp2.txt and so on depending on how many lists you got, and then on application exit you just remove the temp files.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
I'll have a look at that - looks interesting indeed. Thanks

Regards, Ricky
 
Upvote 0
Top