Android Killer
Android Killer

Reputation: 18489

How Pass data from one fragment to another

In one of my project i am using 2 fragments.one fragment is displaying a list of items.So i want when the topic will be selected in first fragment the details should be changed in another fragment.Data i am able to pass from one fragment to other but the view is not changing.In which method i should implement the view of second fragment so that it can change accordingly.

Upvotes: 0

Views: 4745

Answers (1)

Mister Smith
Mister Smith

Reputation: 28168

See this link. It describes exactly your problem.

Basically, you have a listener on the items fragment to be notified on each item selection. The class implementing the listener interface may be the Activity or even the other fragment. When the listener is notified, it updates the details fragment.

Upvotes: 2

Related Questions