Gavin Bong wrote:

I'm getting this error when running "ant aidl".

/data/projects2008/android/iteration1/lib/src/org/android/ common/IAdUnitAvailability.aidl:5 parameter 1: 'Advert ad' can be an out parameter, so you must declare it as in, out or inout.

IAdUnitAvailability.aidl

I have an interface method with signature:

void gimmeAds( Advert ad );

What am I missing ?


AIDL isn't Java. It's real close, but it's not Java.

One thing AIDL has that Java doesn't is the notion of "direction" for parameters, which determine what data needs to be copied "on the wire" as objects get passed from the client to the server and back again.

If the Advert ad parameter is purely input -- meaning it's data passed from client to server -- you need to declare it in the AIDL as:

void gimmeAds(in Advert ad);

If the Advert ad parameter is purely output -- meaning it's data is passed from server to client -- use:

void gimmeAds(out Advert ad);

If the Advert ad is both input and output -- the client provides a value, and the server might modify it in ways the client needs to see -- use:

void gimmeAds(inout Advert ad);

This is only needed for non-primitive parameters to AIDL methods. So if the ad parameter were a float instead of an Advert, you wouldn't have received the error.

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android之音频录音
  2. 多线程实现Android更新进度条
  3. Android(安卓)ApiDemos示例解析(161):Vie
  4. java/jdk版本不对导致android编译错误
  5. Failure [INSTALL_FAILED_TEST_ONLY: ins
  6. Android基于opencv进行图像识别并找出中
  7. 2013.12.04 ——— android SlidingMenu
  8. android多国语言文件夹文件汇总
  9. ImageView的属性android:scaleType,即Imag
  10. android UI设计属性中英对照表(未修订)