【问题标题】:Android: Why do we need an IBinder for the Messenger to communicate with the Handler?Android:为什么我们需要一个 IBinder 来让 Messenger 和 Handler 进行通信?
【发布时间】:2014-10-24 04:05:02
【问题描述】:

在给定on this page的代码的第三个sn-p的上下文中,有一个Messenger named getBinder()的方法返回the IBinderMessenger用于与associated Handler通信。

现在为什么我们需要一个IBinder 来让Messenger 与处理程序通信,而Messenger 是对Handler 的引用,并且两者都是在同一个class 中创建的?

【问题讨论】:

    标签: android android-service android-handler android-binder


    【解决方案1】:

    Messenger 执行“跨进程的基于消息的通信”。 Binder 是“轻量级的远程过程调用机制”。 android 中几乎所有在进程之间发送数据的东西都使用 Binder。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-22
      • 1970-01-01
      • 2021-07-24
      • 1970-01-01
      • 2011-08-27
      • 1970-01-01
      • 2016-03-18
      • 1970-01-01
      相关资源
      最近更新 更多