i have a bottomnavigation in my activity and have 4 button in that. each button load a fragment. first button is home and load when start activity. each time user click on each button, one fragment add to backstack, and each time click on home button back stack clear.my problem is if user go from home to button "A" and next go to button "C" and next go to "A" when 2 time press back,user go to "A" fragment. i want each time user click on button and that fragment was in backstack old fragment remove from backstack and new fragment push to backstack, similar instagram.
Asked
Active
Viewed 37 times
0
-
check if the fragment is available in backStack or not if yes then remove it from stack before adding new – Lokik Soni Jul 31 '19 at 06:30
-
you can check this : https://stackoverflow.com/questions/18305945/how-to-resume-fragment-from-backstack-if-exists – Tariqul Islam Jul 31 '19 at 07:18