i have a problem in my application when i click back activity called two times , when my application idea is : 3 activities (LoginActivity , MainMenuActivity , and CashActivity ) user signed in from LoginActivity to CashActivity but when pressed back going to MainMenuActivity and when click back from MainMenuActivity going to LoginActivity when i click back from LoginActivity called LoginActivity two times .
My code :
@Override
public void onBackPressed() {
Intent intent = new Intent(this, MainMenuActivity.class);
finish();
this.startActivity(intent);
}
this code called in all these activities .