alexjie

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

aidl--android interface define language.

First use aidl define a file named .aidl in the class folder. In the aidl file, you should define your interface class which includes abstract methods. Then in your gen folder, there will automatically generate a .java file which has the same name with .aidl file.

Second, you should create the service/client. In the service point, you should define one class which extends Service and define one object which implements the interface you defined in the .aidl. In the service, you should return the object (IBinder) in the function onBind().

client point, you should connect with the service, use startservice. And you will get the IBinder, then you can enter the servcie space.

 

Code:

 

 

posted on 2013-03-21 19:15  alexjie  阅读(137)  评论(0编辑  收藏  举报