How to have Android Service communicate with Activity

前端 未结 13 1887
说谎
说谎 2020-11-22 02:54

I\'m writing my first Android application and trying to get my head around communication between services and activities. I have a Service that will run in the background an

13条回答
  •  别跟我提以往
    2020-11-22 03:21

    As mentioned by Madhur, you can use a bus for communication.

    In case of using a Bus you have some options:

    Otto event Bus library (deprecated in favor of RxJava)

    http://square.github.io/otto/

    Green Robot’s EventBus

    http://greenrobot.org/eventbus/

    NYBus (RxBus, implemented using RxJava. very similar to the EventBus)

    https://github.com/MindorksOpenSource/NYBus

提交回复
热议问题