Android classes and persistence
<p>I know about <a href="http://developer.android.com/guide/topics/data/data-storage.html" rel="nofollow">Android data storage options</a> and have tried most of them out. But I am not sure how to decide which of those methods would be best for me. I have what I consider a pretty well defined class hierarchy with subclasses, with each class having several member property variables and arrays of other subclasses... on paper. But how do I make it persistent? And keep the object-orientation in tact? For instance, if I have the following class</p>

<pre><code> MyClass
 - private String s1
 - private ArrayList&lt;MySubclass1&gt; subclassList
 - public get/set s1
 - public get/set subclasslist
</code></pre>

<p>Well, this is great for oo, and I can create getters and setters for the member variables, but they aren't persistent. I'll have to take snapshots of the data at certain times to ensure the data does persist. The other option is to use all database storage and get rid of the private member variables and then just use public methods that read and write from the database. This is great for persistence, but I lose that finely structured object orientation. And that ArrayList gets kind of funky. I will have to do stuff like</p>

<pre><code> MyClass myClass = new MyClass();
 MySubclass1 mySubclass1 = new MySubclass1();
 myClass.AddNewSubclass1ObjectToSubclassList(mySubclass1);
</code></pre>

<p>instead of</p>

<pre><code> MyClass myClass = new MyClass();
 MySubclass1 mySubclass1 = new MySubclass1();
 myClass.subclassList.Add(mySubclass1);
</code></pre>

<p>And I would have to write methods for count, remove, indexOf, and all of the other great methods that come with ArrayLists. </p>

<p>So, have I missed something obvious? Am I making this harder than it really is? What is the best way to deal with this?</p>
