My app use 5 fragment, like this:
[1]through[onClick on actionBar defined in activity]->[2]->[3]->[4]->[5]
Each fragment is added to the back stack so I can go back while pressing the back button. However, I would like to return to the first fragment when pressing the back button on the 5th fragment, like this:
[1]<-[2]<-[3]<-[4] [1]<-[5]
I tried to make it this way:
fragmentTransaction.addToBackStack("firstfragmenttag");
When adding the 5th fragment on the 4th one, but when I press the back button it still send me back to the 4th instead of the 1st! Is it a simple way do do that programmatically? Thanks in advance.