how to override action bar back button action in Android?

175 Views Asked by At

I need to navigate up one more step on back pressed from the action bar back icon. It only takes me to previous back stack entry. How can I override this action so I can go one more step back. I tried removing the fragment from being added to the backstack and that worked for me. But I cannot remove it from backstack because I need to to be there for some other purpose.

1

There are 1 best solutions below

0
Ömer Seyfettin Yavuzyiğit On

if your code has this remove it -> addToBackStack(null)