I am developing on an Android app in which I want to prevent going back to SignIn activity after user logged in. I have tried Intent.FLAG_ACTIVITY_CLEAR_TASK, but it doesn't work
Intent intent = new Intent(SignInActivity.this, FirstPage.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
And I have also tried adding finish right after start Activity, but that simply gives me a leaked window error.
Intent intent = new Intent(SignInActivity.this, FirstPage.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
The path of my activities is:
MainActivity(description of my app) <-> SignInActivity(sign in) -> First(logged in).
User can go back and forward between MainActivity and SigInActivity. How can I prevent users going back to SignInActivity or MainActivity from FirstPage?
Any idea? Thank you!