Oct 22 |
8:55 AM |
Mark M. |
has entered the room |
Mark M. |
turned on guest access |
Oct 22 |
9:00 AM |
Yaniv |
has entered the room |
Mark M. |
hello, Yaniv!
|
Mark M. |
how can I help you today?
|
Yaniv |
Hi Mark
|
Yaniv |
I have a question about aidl
|
Yaniv |
is it possible to pass an array through AIDL?
|
Mark M. |
do you mean a literal Java array, as in String[]?
|
Yaniv |
more like int[]
|
Yaniv |
or a list
|
Mark M. |
AFAIK both are supported, though they have to be for underlying types that themselves are AIDL-compatible
|
Yaniv |
what does that mean ?
|
Oct 22 |
9:05 AM |
Mark M. |
List<String> should work
|
Mark M. |
List<Restaurant> would only work if Restaurant itself is something that can be passed via AIDL, such as Restaurant being an AIDL-defined interface
|
Yaniv |
View paste
package com.tfl.extprotocolservice;
import com.tfl.extprotocolservice.IParameterCallBack;
// Declare the interface.
interface IParameter {
void getEvent (IParameterCallBack eventCallBack);
void askForParameter(int parameter);
void ask(List<Integer> list);.
|
Yaniv |
in the List line I get an error
|
Yaniv |
"parameter list unknown type"
|
Mark M. |
that may be tied to the Integer more than the List
|
Mark M. |
|
Mark M. |
you would think that it would handle Integer, but possibly it does not
|
Yaniv |
so what kind of lists can it handle?
|
Mark M. |
also, the docs there do not mention support for something like int[], and I have not tried it personally
|
Mark M. |
again, the values in the list have to be something that AIDL could handle individually
|
Mark M. |
so, List<String>, List<CharSequence>, List<IParameterCallback> should be OK
|
Yaniv |
so I can't use a list of integers for that matter
|
Mark M. |
worst-case scenario, create your own ParcelableInteger class
|
Mark M. |
I don't use AIDL much, as I do not use the bound service pattern much, so I have not experimented with many data type combinations
|
Yaniv |
if I create my own class , how will that work?
|
Oct 22 |
9:10 AM |
Mark M. |
anything that is Parcelable can be passed through AIDL
|
Mark M. |
|
Mark M. |
so, ParcelableInteger would be a Java class that holds an int or Integer and implements the Parcelable interface
|
Yaniv |
I see
|
Yaniv |
ok I will try that
|
Yaniv |
thank you
|
Mark M. |
and I see a Google Groups post from 2008 where Dianne Hackborn indicates that Integer itself is not supported
|
Mark M. |
|
Yaniv |
ok..
|
Yaniv |
thanks
|
Oct 22 |
9:15 AM |
Mark M. |
if you have another question, go right ahead -- it is a quiet chat room today :-)
|
Oct 22 |
9:30 AM |
Yaniv |
has left the room |
Oct 22 |
9:55 AM |
Mark M. |
turned off guest access |