【问题标题】:Complex types from a remote service to an application through AIDL通过 AIDL 从远程服务到应用程序的复杂类型
【发布时间】:2010-10-21 14:36:39
【问题描述】:

理想情况下,我想发送一个类型为

的对象
 ArrayList<ArrayList<ASimpleClass>> 

从一个 APK 中的远程服务到另一个 APK 中的应用程序。我不确定这是否可能,因为 API 演示代码表明它不是:

/**
 * 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。如果可能的话,我非常感谢指向一些示例代码的指针,或者将上述类型转换为远程接口 AIDL 可接受的方式的方法。请问有人能解释一下这个问题吗?

【问题讨论】:

    标签: android aidl


    【解决方案1】:

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

    如果您想要的内容不在支持的方法列表中,您仍然可以发送它,前提是您编写代码将其转储为一系列支持的类型并在另一侧重新构建它。

    【讨论】:

    • 感谢您的指点。我想我以前可能见过它,但文档并不是那么有启发性。我发现了这个:anddev.org/… 给我看一个实际的例子
    猜你喜欢
    • 1970-01-01
    • 2022-12-29
    • 2013-03-10
    • 2011-05-16
    • 1970-01-01
    • 2019-07-31
    • 1970-01-01
    • 2015-04-12
    • 2010-10-28
    相关资源
    最近更新 更多