Android BroadcastReceiver or simple callback method?

前端 未结 5 1410
情深已故
情深已故 2021-01-29 20:09

In my projects I am using BroadcastReceivers as a callback from a long running thread (eg. notify the activity that a download was finished and send some response d

5条回答
  •  清酒与你
    2021-01-29 20:32

    Broadcastreceivers should be used If you need to send broadcasts across applications while Callbacks (or Handlers as suggested by Alex) are better to use in your situation.

    If you want to use other than these two, consider using Observer (Interface included in android) and delegate.

    For delegate please consider this SO post.

提交回复
热议问题