zoukankan      html  css  js  c++  java
  • Aidl and Binder Application

    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:

  • 相关阅读:
    【TypeScript】TypeScript中的数据类型
    正则表达式
    约束和异常处理
    面向对象-成员
    初识面向对象
    内置函数二
    生成器和生成器表达式
    函数名的运用
    函数
    文件操作
  • 原文地址:https://www.cnblogs.com/alexjie/p/2974039.html
Copyright © 2011-2022 走看看