I have a login page and then a home page, then I have an exit button on the home page. When you press the exit, I need the app to close.
If I use finish()
on the home page's exit onClick()
,it just take me back to the login page.
So I am using
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Now this does act like an exit but when you start the application again, it by passes the login screen and directly goes to the home page (as the app was never closed). What would be the best solution here?