Otto Event Bus in Android
Why Stack Overflow recommends it
Stack Overflow users link it as a worked example of wiring Otto into Android apps to send data between fragments and activities and to refresh tabs.
Recommended by 1 people across 1 different months, 2016 to 2017.
What it is
A short Android tutorial showing how to use Square's Otto event bus library to pass messages between components, especially fragments and activities. The presenter, Filip Vujovic, gives the Gradle dependency line and walks through a basic bus setup.
What people said
Recommends fasal shah · 2016-04 · Stack Overflow · on “My fragments in viewpager tab dont refresh”
Ok may be a late reply,might help others in future, so recently I faced same issue while fetching data from db into tabs it used to display only once I click on 3rd tab.. I tried above mentioned solution but nothing really worked.. fianlly i came across Otto [LINK] This library allows you to communicate within your app.. Just use this library to yourAdapter.notifyDataSetChanged() wherever you fetching your data from db.. This video helped me alot [this video]
Cites m.developer · 2016-06 · Stack Overflow · on “I can't use any method inside subscribe method otto”
My app show fragment(1) . After that user choose one of another fragments(2-10) for press button . After that, fragment(2-10) send data to activity and open activity -that works well-. Finally, activity edit the data and send it to fragment(1) -here is problem- . So I use otto. I use the same way except I didn't use FragmentManager class , [this video] .Also I don't change anything in manifest and gradle except add compile of otto . My problem is ,I can't use any methods inside subscribe method .Even I can't write message.getmsg()= my_varible
Cites m.developer · 2016-06 · Stack Overflow · on “send data from activity to activity class and between them fragment”
@Evin1_ I don't change any thing in mainefast or gradle except add compile . I use otto . My problem is I can't use any method inside subscribber method . Even I can't write getmsg.message = my_varible ; I use this way [this video]
Cites user3796130 · 2017-02 · Stack Overflow · on “Passing data from Activity to Activity using Otto is not working”
It's the first time that I'm using this library, but I was following this [this video] video tutorial to send data through Fragments, but in my case, it's just Activities.. So this how I did Activity that I'm sending data : public void onClick(View view) { String passing_data = new Gson().toJson(user); BusStation.getBus().post(new MessageData(passing_data)); Intent intent = new Intent(activity,UserAdsView.class); activity.startActivity(intent); } BusStation Class : public class BusStation { private static Bus bus = new Bus(); public static Bus getBus() { return bus; } } MessageData Class : public class MessageData { private String msgData; public MessageData(String msgData) { this.msgData = msgDa