-14

enter image description here

Hello, I Have one Activity and two fragments, I want to come back from Fragment 2 to fragment 1. How to go back?

Mr Rubix
  • 1,404
  • 14
  • 26

2 Answers2

-2

Before going forward, add your fragment to back stack and later call popBackStack

Marius Kaunietis
  • 645
  • 4
  • 17
  • It's help, but, when I go from frag 1 to frag 2, I chagne Toolbar title (from Profile to Edit profile), but when I press back Button, Toolbar title does not changed back. How can i Solve it? Sorry for my bad English – – Karo Hovhannisyan Mar 21 '16 at 11:04
  • So.. just change it back to whatever you want after popping back stack. – Marius Kaunietis Mar 21 '16 at 11:10
-2
getFragmentManager().popBackStack();

Hope this help you

Silvans Solanki
  • 1,261
  • 1
  • 14
  • 27