0

I want to save my Android game state so the user can pick up and play from where he/she left off. I have been reading about the serializable interface, but have some questions.

Aside from background rendering and a few other things my game is performed from one class. Let me explain what that means. I have a class A, and all the different elements of the game are stored in various arraylists and such, in A. SO I have dozens of instances of classes B,C,D,E... all being called and updated (when the screen updates) from class A.

My problem is I am unsure what needs to be serializable. Every class B,C,D.. (i.e. every class? or just A? I don't see why serializing A and then saving the output in SQLite DB wouldnt store all the data.

2 Answers2

0

if you want to serialize some object. then look at this link use other object in place of hashmmap object that has been specified in this link.

Community
  • 1
  • 1
N-JOY
  • 10,344
  • 7
  • 51
  • 69
0

Just as a suggestion, you may also want to look at Berkeley DB Java Edition, specifically at the DPL (Data Persistence Layer) API. Like SQLite, it's a transactionally protected, recoverable, fast, small footprint database library. However, the DPL allows you to directly persist your classes, making it a much easier choice for Java application developers.

Here's a technical white paper describing the API and how to use it.

dsegleau
  • 1,942
  • 9
  • 13