0

the scenario is, I have two fragments, one is Category List and another fragment is Product list w.r.t category list, so when I click on Item into the category list, then I want to send selected value to the Product List Fragment then how can this possible please help me.

Puja
  • 192
  • 9

3 Answers3

0

You can Use "Broadcast Receiver" to receive data or to tell fragment to update data

https://developer.android.com/reference/android/content/BroadcastReceiver

http://codetheory.in/android-broadcast-receivers/

0

You can use EventBus library. It is a good library for notifying and passing data from fragment to fragment. Check it here: https://github.com/greenrobot/EventBus

Raymond
  • 39
  • 3
0

The best way of doing this is to use Google Architecture components, ViewModel and LiveData. In this link, you'll find an example that will help you to archive what you want.

TheTechWolf
  • 2,084
  • 2
  • 19
  • 24