jeudi 16 avril 2015

How to save/store multi dimensional list of objects in an Android Application?

If someone could think of a better way to ask this question that would be great as I'm not sure how to best sum it up.


In my application I currently have 3 types of class. A, B and C.



  • My App holds a list of objects A.

  • Class A has various arbitrary fields + a list of objects B.

  • Class B has various arbitrary fields + a list of objects C.

  • Class C is just a standard class with arbitrary fields.


What would be the best way to save the instances of these classes?


My current method would be to hold the main list of objects A in an extended Application class and then save the serialized list Object as a SharedPreference or in a database. Then load/save it up whenever the app restarted or paused etc. Would this be a good idea?


I know how to use SQL on android at a basic level and would use this if not for the multiple dimensions present. Is there a way to make it work with a database?


Any other advice would be appreciated. Thank you.


Aucun commentaire:

Enregistrer un commentaire