I am struggling to figure out the correct architecture for a pretty simple app using the navigation component. I basically have a splash screen that checks if the user has a valid token and then either sends to the main fragment or the login fragment. The problem is that if I send to the login fragment, the back button allows the user to go to the main fragment. I have looked into disabling the back button, but that seems hacky. Do I need to set up 2 activities with 2 different nav graphs? or is there a cleaner way to do this?
Asked
Active
Viewed 136 times
2 Answers
0
In this case the best solution is to use Double press back to exit app Use this solution in your main fragment to achieve the double back to exit.
![](../../users/profiles/9882579.webp)
MohanKumar
- 494
- 3
- 20