Domanda

What is the recommended approach/pattern for exchanging big chunks of data between activities and remote services? The data I want activities to receive is non primitive and is contained in HashMaps of <Object, List<OtherObject>>. Parcelable seems to be complete overkill to me, is there another way? Oh, and this exchange takes place every 4 sec. on average.

È stato utile?

Soluzione

The most efficient way of exchanging big chunks of data between processes in Android is ashmem. There is a Java wrapper for ashmem - MemoryFile, but it is rather confusing - you need to pass parcelable file descriptor between processes, please refer to this SO post

Then you can just serialize your data into that "file" and deserialize it on the other side.

Altri suggerimenti

Do you need to refresh the data every 4 seconds? That seems ambitious to me. In any event, you have to consider what form you're going to store it in. You need to focus on efficiency; download as little "meta-data" as possible and cache it.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top