Fragment Related

  • Replies:3
  • OpenNot stickiedUnanswered
  • Forum posts: 3

May 16, 2017, 10:33:25 AM via Website

Am new to android i dont know how to do that, Any one give the solution,
I have one main activity with button in that i have two fragments, by default one fragmnet is loaded, if i click a button default fragment need to hide and show another fragment , when i click back button in toolbar it needs to show default fragment. givew solution to that, thanks in advance

  • Forum posts: 54

May 17, 2017, 2:55:15 PM via Website

Just use fragment (support) manager to change fragments and override default onBackPressed() behaviour to do what you want. That's all you need.

Ragu K.

  • Forum posts: 3

May 24, 2017, 8:52:07 AM via Website

In onBackPressed() method what can i do, if show as first fragment, then back button not working

  • Forum posts: 18

May 25, 2017, 5:17:20 AM via Website

What do you mean, the back button doesn't work? You activity should be able to handle it. Probably you are using the wrong handler.

Recommended by NextPit