-4

I am simply closing fragment and going back to previous one by

 getFragmentManager().popBackStack();

And it works, fragment is closed. But when I put the same code in the activity method and call it, then nothing happens.

 ((FragmentRouter)getActivity()).goBack();

And the implementation

@Override
public void goBack() {
    getFragmentManager().popBackStack();
}

How can it be? The code is the same and we are in the same line of event processing.

Goku
  • 9,102
  • 8
  • 50
  • 81
Arnie Schwarzvogel
  • 955
  • 1
  • 13
  • 25

1 Answers1

1

My fault: of course the two calls of getFragmentManager() are not identical, since they include implicit "this" which is Fragment in one case and Activity in another case.

Works by using:

getSupportFragmentManager().popBackStack()

in Activity

Arnie Schwarzvogel
  • 955
  • 1
  • 13
  • 25