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.
精彩评论