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.

4

2 回答 2

0

如果你想序列化一些对象。然后查看此链接使用其他对象代替已在此链接中指定的 hashmmap 对象。

于 2011-03-11T10:16:00.780 回答
0

作为一个建议,您可能还想查看Berkeley DB Java 版,特别是DPL(数据持久层)API。与 SQLite 一样,它是一个受事务保护的、可恢复的、快速的、占用空间小的数据库库。但是,DPL 允许您直接持久化您的类,使其成为 Java 应用程序开发人员更容易的选择。

这是描述 API 及其使用方法的技术白皮书。

于 2011-03-14T00:23:51.793 回答