Redeem Now
Read More
Read now

Calling another fragment for result from one fragment.


You can see everywhere written that an activity can be converted into fragment very easily but what to do when you have to call a fragment for result from another fragment it is kind of look weird but it is a scenario you can face when you have a fragment and then have to call different fragments from it to get result and show that result in your fragment (earlier one).

But there is a solution for this problem as well. All you have to do is implement your activity (calling all those fragments) with FragmentManager.OnBackStackChangeListener and then bind this listener to your FragmentManager object. Now in the implementation of this listener call a method of your fragment you want to call when that fragment is popout of the BackStack like

and you can do anything inside this method of your fragment. But remember to add each of your fragment to backstack as this listener is called only when you pop out a earlier fragment from back stack.

. . .


Add Your Comment

Be the first to comment.

Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again