Android AIDL 问题求解

sky123123 2013-08-05 09:30:48
在AIDL文件中,如何传递List<int>参数呢?
比如:

package com.test;

void test(in List<int> list);


这样写 死活就是编译不过去。

如何传递List<int> 呢 而不是int[];

求大神解答啊 感谢
...全文
162 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaanming 2013-08-08
  • 打赏
  • 举报
回复
AIDL文件中没有导入List包吧
ameyume 2013-08-07
  • 打赏
  • 举报
回复
http://developer.android.com/guide/components/aidl.html By default, AIDL supports the following data types: All primitive types in the Java programming language (such as int, long, char, boolean, and so on) String CharSequence List All elements in the List must be one of the supported data types in this list or one of the other AIDL-generated interfaces or parcelables you've declared. A List may optionally be used as a "generic" class (for example, List<String>). The actual concrete class that the other side receives is always an ArrayList, although the method is generated to use the List interface. Map All elements in the Map must be one of the supported data types in this list or one of the other AIDL-generated interfaces or parcelables you've declared. Generic maps, (such as those of the form Map<String,Integer> are not supported. The actual concrete class that the other side receives is always a HashMap, although the method is generated to use the Map interface. AIDL支持List类型。
doveqian 2013-08-07
  • 打赏
  • 举报
回复

void playSoundEx(in List<SoundInfo> mSoundInfo,  String entry);
我这样用 可以啊
Jobernowl 2013-08-06
  • 打赏
  • 举报
回复
可以用数组 把你的集合转成数据即可 支持你自己的类型
儿大不由爷 2013-08-06
  • 打赏
  • 举报
回复
你先看看文档吧,AIDL不支持这种类型。 支持的数据类型很少。

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧