I Have 2 activities: activity X & activity Y.
Y sends data to X via an intent and X displays the data in a listView.
The problem I am having is saving the listView in X so the next time a user goes to activity Y and sends an intent the listView will display the last data that was send + the new data, this way the user will continue to populate the ListView .
I was thinking about saving all the data in a sqlLite database and then retrieving it and displaying the updated listView that way?
or maybe to serialize my list and save it via SharedPrefs (not sure if that would actually work,I am a really new at this)
Any suggestions and code samples would be appreciated!!!! THANK YOU!
If you have a small amount of data (<5 variables) I suggest you to implement a Sharepreferences class with the methods you need (basically, put and get). For more than that, someone told me to use SQLite, but I’ve never used before, even if it seems easy to put in place.
Besides, these are methods useful if you want to store data even if the app is closed, and you could retrieve them after in another session. If data lives only for a session, put everything in a bundle and go back and forth with it.