vendredi 22 janvier 2016

Android Parcelable vs SQLite

Is it cheaper to send data across Activity using Parcelable or using SQLite? I am using SQLite (through Content Provider) to persist my data. So really I always have access to my data through SQLite. But I am not sure whether I should send data across Activity using Parcelable or should I just grab them each time.

The details. say I have a Village object. So naturally Village is relatively big: it contains Lists of People for instance, which in turn may contain List of Clothes. In onPause of each activity I persist Village to my Content Provider. But sometimes I want to send a Village object from one Activity to another. I have two choices: I can send the dbId to the next activity and then query the URI (and then convert the cursor to a POJO), or I can send a Parcelable of Village. Which is more expensive?

Say Parcelable is cheaper (I don’t know yet). Right now I am struggling to get the Parcelable to work. Is it worth the effort to get Parcelable to work?

Aucun commentaire:

Enregistrer un commentaire