当前位置:编程学习 > wap >>

Android AIDL 问题求解

在AIDL文件中,如何传递List<int>参数呢?
比如:

package com.test;

void test(in List<int> list);


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

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

求大神解答啊 感谢
Android aidl --------------------编程问答-------------------- 你先看看文档吧,AIDL不支持这种类型。
支持的数据类型很少。 --------------------编程问答-------------------- 可以用数组   把你的集合转成数据即可   支持你自己的类型 --------------------编程问答--------------------

void playSoundEx(in List<SoundInfo> mSoundInfo,  String entry);


我这样用  可以啊 --------------------编程问答-------------------- 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类型。 --------------------编程问答-------------------- AIDL文件中没有导入List包吧
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,