So, I am making a basic chess application to play with some elements of android programming, and still I am learning a lot, but this time I got lost.
When the emulator orientation changes, the activity gets reset. Based on my research, the same thing will happen at any time when the application is paused / interrupted, i.e. keyboard change, phone call, pressing the home key, etc.
Obviously, there is no constant game of chess reset, so again I want to find out how to fix this problem.
In my research, you will learn a few basic things by overriding the onPaused method in my activity, listening to Orientation, changing the keyboard in my manifest (via android: configChanges), using Parcelables or Serialization.
I searched for a lot of code examples using Pacelables, but to be honest, this is too confusing. Maybe returning tomorrow with new eyes will be useful, but now, the more I look at Parcelables, the less it feels.
My application uses a Board object that contains 64 Cell objects (in an 8x8 2D array) and each cell has a Piece object, either the actual fragment, or zero if the space is empty. Assuming I am using Parcelable or Serialization, I assume that I would have to Parcelize or Serialize each class, Board, Cell and Piece.
First of all, is Parcelable or Serialization even the right thing to look at this problem? If so, is Parcelable or Serializable preferable for this? And do I correctly assume that each of the three objects should be delayed / serialized? Finally, does anyone have a link to an easy-to-understand Parcelable tutorial? All that will help me understand and stop further headaches in the future when my application expands even further.
Any help would be appreciated.