Android

ইভেন্ট বাস (EVENTBUS) -> এন্ড্রয়েড ইভেন্ট ম্যানেজার ইমপ্লিমেন্টেশন (এক্টিভিটি এবং ফ্রেগমেন্ট)

EventBus

ইভেন্ট বাস (EVENTBUS) -> এন্ড্রয়েড ইভেন্ট ম্যানেজার ইমপ্লিমেন্টেশন (এক্টিভিটি এবং ফ্রেগমেন্ট)

 

 

eventbus_
eventbus_

We will try to store our class like this above hierarchy.

Add this below code in your module:app gradle file

Add this to your styles.xml  under values folder

Add this to your color.xml under values folder

Add this below code in your MainActivity.java class

Add this below code in activity_main.xml

Add this below code in FragmentActivity class

Add this below code in fragment_activity.xml

Add this below code in MessageEvent POJO class

Add this view code in viewPagerAdapter class

Add this below code in FirstFragment class

 

Add this below code in SecondFragment Class

 

Add this below code in first_fragment.xml

 

Add this below code in second_fragment.xml

 

Add this below code in AnotherMessageEvent POJO class

 

Output

eventbus
We enter a message. show it into main activity and then pass the message into another fragment
eventbus
This is our sticky message
eventbus
This another normal message in second fragment

 

Resource:

  1. https://github.com/greenrobot/EventBus/
  2. https://guides.codepath.com/android/Communicating-with-an-Event-Bus/
  3. http://timnew.me/blog/2014/12/06/typical-eventbus-design-patterns/
  4. http://www.andreas-schrade.de/2015/11/28/android-how-to-use-the-greenrobot-eventbus/
  5. google.com

Leave a Reply

Your email address will not be published.

five + 7 =