I'm using a listView and wants to restore/ resume the listView item/ state from where I had left (even after app closes). For this purpose I'm using
Parcelable state = listView.onSaveInstanceState();
the state is of Parcelable type because it returns result in parcelable type also while on restoring listView using
listView.onRestoreInstanceState(state);
it needs Parcelable type data as a parmeter. It works perfectly (using static variable) if user didn't closes the app. But I want to save this state data into SharedPreferences that will help the user to restore the listView even after closing the app.
I don't know how to store this state data into SharedPreferences. Please help me to solve this issue.
I also have tried this solution How Android SharedPreferences save/store object but it didn't solved my problem. The app is crashing on
Parcelable obj = gson.fromJson(json, Parcelable.class);
So, Please don't duplicate my question, If you know the solution just answer it.