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.

. . .

Leave a comment


Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home