Complex types from a remote service to an application through AIDL

ぃ、小莉子 提交于 2019-12-12 18:34:35

问题


Ideally I would like to send an object of type

 ArrayList<ArrayList<ASimpleClass>> 

from a remote service in one APK to an application in another. I'm not sure if this is even possible as the API demo code suggests that it isn't:

/**
 * This demonstrates the basic types that you can use as parameters
 * and return values in AIDL.
 */
void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat,
        double aDouble, String aString);

whilst the autocomplete for writeTo/readFromParcel suggests that other types are an option (though read options don't match write). I would settle for just ArrayList if necessary. If it is possible, I'd much appreciate a pointer to some sample code, or a way to cast the above types into something acceptable to the remote interface AIDL. Can anyone shed any light on this question please?


回答1:


http://developer.android.com/reference/android/os/Parcel.html

If what you want isn't on the list of supported methods, you can still send it provided that you write code to dump it out to a series of supported types and rebuild it on the other side.



来源:https://stackoverflow.com/questions/3988609/complex-types-from-a-remote-service-to-an-application-through-aidl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!