문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top