So, i have looked at many different ways and posts about saving and restoring an activities state. I know how to do it for preferences, checkboxes, ect…
But in this example application i am trying to save the state of a gridview. So in the application, you can add an image then long click it and add it to a cell. Basically a drag and drop. But when the application is eventually terminated and then relaunched, all the cells are empty.
How would i save the state of the gridview to restore after the application was “terminated”?
I am using this source as an example… https://blahti.wordpress.com/2011/10/03/drag-drop-for-android-gridview/
You can keep your app state in something like
HashMap.HashMapimplementsSerializableinterface, thus it can be saved toBundlevia putSerializable method.In this HashMap you can keep state of grid, e.g. which drawable (its id?) is saved in each cell.