I have default Master-Detail flow, which was created automatically when creating new project. My question is. When I add a button to detail side. Is there a way to update my list side by pressing that button ? In other words, can ItemDetailFragment and ItemListFragment communicate ?
I have default Master-Detail flow, which was created automatically when creating new project. My
Share
Yes just communicate through the activity with a listener.
Your activity:
The listener class:
Your fragments will then have following somewhere in code in order to implement the interface:
Then your fragments communicate with each other like this: fragmentA -> activity -> fragmentB. Your activity can call methodes directly on the fragments without worrying about synchronization problems.
Example of a call from fragment a:
Activity then handle: