2

I have the following scenario: I am parsing a JSON Response from a server into a sqlite database and then I am using the database and datamodels for querying, filtering, ...

A colleague of mine, an iOS developer, says, that he doesn't do JSON parsing into datamodels and persistence into database anymore. He just takes the dictionaries, makes them app-wide available and for persistence saves them into a binary file.

Now I would like to know, does anybody do it the same way on Android? Will it be a problem to have say 1000 HashMap-Objects in the App (each having about 10 other Objects (Strings))? Seems quite much to me, will it drop my app performance? But why does it work well on iOS?

asked Nov 4, 2011 at 16:30

3 Answers 3

2

We do both in different projects. One project that we keep the data in json has a lot of different fields and some tree structure, so storing it to a DB would be a lot of busy work. However, we have run into memory issues because of the size.

To make your data life easier, and to have a rough parallel to CoreData, take a look at http://ormlite.com/. Its an orm tool that works with Android/Sqlite. I did the initial Android port and use it in pretty much every project I do. If you have a lot of data and only access small parts, database is potentially better.

1000 objects wouldn't really kill you either way, but its project specific and hard to say. I don't think keeping Json in memory is going to be any better on either platform, however. At least not orders of magnitude.

answered Nov 4, 2011 at 17:10
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot. I am trying it now, but maybe in my next project I will have a look at ormlite.
0

Do you want to persist the data? If you want it to be accessible from one application run to the next, you have to persist it by doing something like storing it in to a file. I find that a database is easiest, but I guess if you really want to you can put it in some sort of binary file. But then you have to worry about how to go back and forth from that serialized data.

If you'd rather keep everything in memory during the life of your application, that's fine. You probably will notice some speed increases. And a 1000 object HashMap should fit in your memory just fine.

answered Nov 4, 2011 at 16:35

Comments

0

I can't tell from your colleague's description, but his implementation might be using CoreData, an iOS facility that doesn't have a parallel in Android. The description you provided matches it at a high level. Other ways of addressing that functionality on Android have been addressed here.

answered Nov 4, 2011 at 16:53

1 Comment

It seems he doesn't use CoreData, because he states he's just using the plain dictioniaries.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.