在aidl(ipc)中传递自定义arraylist

时间:2015-11-01 06:14:37

标签: android ipc aidl

我正在尝试在进程间通信中传递自定义arraylist。 我制作了两个这样的aidl文件

IMyAidlInterface.aidl

package com.amaze.DrivePlugin;
import com.amaze.DrivePlugin.Layoutelements;
// Declare any non-default types here with import statements
interface IMyAidlInterface {
    /**
     * Demonstrates some basic types that you can use as parameters
     * and return values in AIDL.
     */
    ArrayList<Layoutelements> list(in String driveID);
}

这里Layoutelements是一个实现parcelable

的自定义类

Layoutelements.aidl

package com.amaze.DrivePlugin;

// Declare any non-default types here with import statements
parcelable Layoutelements;

错误说“未知的返回类型arraylist”。

我也尝试导入arraylist,但没有帮助

1 个答案:

答案 0 :(得分:1)

使用 java.util.List 代替ArrayList通常可以解决问题