e-mre
e-mre

Reputation: 3383

SQLite performance choice on Android

I am developing an application on Android using SQLite. I am quite new to SQLite so I want to ask about a design choice.

If you want to pass an object (which represents a row in the DB) from one activity to another, which one of the below is faster and/or resource efficient?

Either case, what would be the performance difference between these two choices?

Upvotes: 3

Views: 159

Answers (1)

323go
323go

Reputation: 14274

It really does depend on the size of your row. If it's relatively small (a handful of primitives) passing the serialized data around isn't a big deal, although you might want to use something that's a bit lighter weight than JSON. If you have a large set of data (blobs, etc), then the performance hit from fetching the row off disk vs. serializing and deserializing is probably even or less. Ideally, you'd fetch the data only once and store it in a singleton, to be accessed by different activities, likely as POJOs.

Upvotes: 1

Related Questions