java - Android object handling / persistence -


I am far away from my first Android application, and I secretly suspect that I am "doing this wrong". My app talks in Ruby on the railway server and serials back and forth through XML. Before I knew what was happening, I hugged myself that I am deep in writing my dirty ORM, a problem related to the fact that I have not written any word from high school.

My struggle is here that I want to be able to sort my Client-Side (Android) app through various ways, such as HTTP / XML, in a local database, or through local file system I am I started with a strategy pattern, but I feel that there is a scarcity of my solution.

For one, should I re-apply rail model recognition on the client side, because I do not know whether I am working with the railroad on the other side? The bigger issue is that I can only represent the key values ​​for flat objects, because my code can not handle nested objects such as a correct ORM.

I am sure Android developers have time to deal with this, so I am interested in hearing what other people have done with these issues.

I will not contact your Android application as an extension of Ruby App - but rather a consumer API . If you can try to highlight your server application as JSON (or other format, but JSON is the easiest) and you can consume these APIs from your Android episodes then you have the lowest probability because JSON is already Is in K / V format only.

I have not yet written Android objects to SQLite, but I have written them as parcelable objects and shared pages, both of these strategies are small enough for mid-range applications. For data intensive app, obviously you have to take this SQLite one step further.

There are some great articles for these methods:

It provokes your objects to be designed in such a way that can be easily serialized. It means no circular references or extremely complex objects. This should not be a big problem, especially if your data is already in JSON format. You just need to expand some sections and add functions that return a parcellet eligible representation or string representation so that your objects Can be saved.

I would like to avoid cloning my server-side object and verification on Android. Then if you make small changes then both sources need to be modified. The server should handle all data and verification and you should just send data, send caching and data from Android.

I would be interested in hearing if there is a challenge in writing the object to SQLite, but I imagine this is not a lot more than the statement that I have mentioned above. Hope this helps in some capacity!


Comments