0

In the AIDL guide (http://developer.android.com/guide/components/aidl.html) it mentions that all primitives are "in" parameters. However, I'd like to create a parameter that is a primitive and it is an "out" variable i.e. the server will set it for me.

Besides creating my own Parcelable primitives and doing all the work myself, is there a work-around for this issue? I've tried the class-version of the primitives (Integer, Boolean, etc.) and those don't seem to work :(

thanks, J

Jon
  • 1,381
  • 3
  • 16
  • 41

2 Answers2

1

AIDL is allowed between processes (the server may be in another app run in another VM entirely), so you can't send anything that doesn't implement parseable, except those things that Google special cased (like lists). And since Java is pass by value only for primitives, those won't work. A possible work around would be to use a list of values as an out parameter, but I'm not certain it would work (never tried it). But writing a simple wrapper of your own wouldn't be hard.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
0

Some other options:

1) If you only need to set one parameter, you could just return the parameter

2) Define callback function in which to return the parameters

vman
  • 1,264
  • 11
  • 20