开发者

How to pass complex data structures (example: a vector with many elements) between service and the remote binder?

The object passing between an Android service and the remote binder is happening thr开发者_如何学运维ough serialization of the object. If the service needs to return a very large collection, it seems very inefficient to use this. What is the recommended way to deal with this?

Thanks.


In Android you should implement Parcelable rather than Serializable on your objects, as the performance is much better. Your AIDL method can then specifiy a Parcel as an argument.

Here's the SDK documentation about passing Parcelable objects to a Service which has some sample code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜