复杂类型从远程服务,通过AIDL应用 [英] Complex types from a remote service to an application through AIDL

查看:229
本文介绍了复杂类型从远程服务,通过AIDL应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

理想我想送类型的对象

 ArrayList<ArrayList<ASimpleClass>> 

这是一个APK到另一个应用程序的远程服务。我不知道这甚至有可能作为API演示code表明,它是不是:

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);

而对于的writeTo / readFromParcel自动完成建议,其他类型是一种选择(虽然读选项不匹配写)。如果需要的话我会满足于仅仅的ArrayList。如果有可能,我更AP preciate一个指向一些示例code,还是有办法投上述类型分为远程接口AIDL东西可以接受的。任何人都可以摆脱在这个问题上任何光线好吗?

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?

推荐答案

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

如果你想要的是不支持的方法就行了,你仍然可以把它只要你写code倾倒出来的一系列支持的类型,并重建它的另一面。

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.

这篇关于复杂类型从远程服务,通过AIDL应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆