I am using moveTaskToBack() method in my activity.
When I am pressing back button the activity still is visible. The back key does not work. What did I do wrong here
Launch -> isSignIn(yes) ->
MainActivity
-> Press Back -> Close.
Launch -> isSignIn(no) ->
SignInActivity
-> Press Back -> Close.
Launch -> isSignIn(yes) ->
MainActivity
-> Press Sign Out ->SignInActivity
-> Press Back ->SignInActivity
-> Press Back ->SignInActivity
(and so on loop and stuck onSignInActivity
until i press history/recent app/home button).
Launch -> isSignIn(no) ->
SignInActivity
-> Press Sign In ->MainActivity
-> Press Sign Out ->SignInActivity
-> Press Sign In ->MainActivity
-> Press Back ->MainActivity
-> Press Back ->MainActivity
(and so on loop and stuck onMainActivity
until i press history/recent app/home button).
SignInActivity
that has Sign In button and MainActivity
that has Sign Out button.@Override
public void onBackPressed() {
super.onBackPressed();
moveTaskToBack(true);
finish();
}
It's now working fine on every situations. When i press Back, the application close.