【发布时间】:2013-11-21 01:34:40
【问题描述】:
尝试将某些接口从 Android 服务应用远程连接到另一个客户端应用,并使用 AIDL 方法..
所以我在 IJobController.aidl 中有一个接口 IJobController:
导入 com.example.jobs.api.IJobExecutionContext;
interface IJobController {
List<IJobExecutionContext> getCurrentlyExecutingJobs();
...
}
其中 IJobExecutionContext 在其自己的 AIDL 中定义:
interface IJobExecutionContext {
Bundle getJobResult();
...
long getJobStartTime();
long getJobEndTime();
long getJobRunTime();
}
当这些定义在 gen 文件夹中编译时,我在生成的 IJobController.java 文件中收到类似这样的错误:
Type mismatch: cannot convert from ArrayList<IBinder> to List<IJobExecutionContext>
The method writeBinderList(List<IBinder>) in the type Parcel is not applicable for the arguments (List<IJobExecutionContext>)
据我了解,此类接口可以与原始类型、Parcelable 等一起用于列表(或地图)中。 在我只返回一个 AIDL 接口的另一种方法中,一切正常,但似乎在列表容器中它不是。
我需要只返回一个原始列表,还是一个 IJobExecutionContext 实现的列表,它也是 Parcelable?
谢谢。
【问题讨论】:
标签: android ipc generic-list aidl