我有实现Queue的X类。
我想将X类的对象传递到AIDL接口。当我在.aidl文件Eclipse中导入类X时
显示错误,并说“找不到导入
类com.test.X。”,尽管该类在那里。
package com.test
public class X implements Queue<byte[]>{
public LinkedList<byte[]> que = new LinkedList<byte[]>();
int push =0, pop = 0;
public Iterator<byte[]> iterate = null;
public X()
{
iterate = que.iterator();// TODO Auto-generated constructor stub
}
}
在Google上搜索时,我发现您必须为要在服务中使用的每个类创建一个单独的.aidl文件。因此,我创建了X.aidl但它没有用。
有人可以提出建议吗?
谢谢。
最佳答案
尝试使您的类实现Parcelable接口。因此,在您的情况下,声明将类似于:
public class X implements Queue<byte[]>, Parcelable {}
您可以阅读here如何实现Parcelable接口。