Replace Fragment with another on back button

后端 未结 3 771
北恋
北恋 2021-01-20 21:36

I\'m trying to override the Back Button because it\'s closing my app when I push on, I have different Fragments:

  • Fragment A: Index (When I press back button, i
3条回答
  •  爱一瞬间的悲伤
    2021-01-20 22:04

    I know this too late for answer, but whoever, visits here, might got help with this, I achieved this through below.

    if you want to change the fragment keeping the activity on click on device back button, above mentioned all codes will work with removing below line.

    super.onBackPressed()
    

提交回复
热议问题