How to pass data between fragments

后端 未结 13 3025
醉话见心
醉话见心 2020-11-22 07:03

Im trying to pass data between two fragmens in my program. Its just a simple string that is stored in the List. The List is made public in fragments A, and when the user cli

13条回答
  •  一个人的身影
    2020-11-22 07:30

    If you use Roboguice you can use the EventManager in Roboguice to pass data around without using the Activity as an interface. This is quite clean IMO.

    If you're not using Roboguice you can use Otto too as a event bus: http://square.github.com/otto/

    Update 20150909: You can also use Green Robot Event Bus or even RxJava now too. Depends on your use case.

提交回复
热议问题