I have an activity which contains a ListView populated with strings. But when I close the app and reopen it, it is empty again. How do I save the content so that the next time I open the app, the ListView is still populated?
Thanks
I have an activity which contains a ListView populated with strings. But when I close the app and reopen it, it is empty again. How do I save the content so that the next time I open the app, the ListView is still populated?
Thanks
To store data permanently you can use one of these options :
To store data in SharedPreferences
:
SharedPreferences data = getSharedPreferences("my_data_pref", 0);
SharedPreferences.Editor editor = data.edit();
editor.putString("key", "value");
editor.commit();
SQLite Databases
: Store structured data in a private database.
Internal Storage
or External Storage