I have a Android application that looks like this:
LoginActivity -> MainActivity
My Android problem is that if we have successfully logged in (we are at MainActivity), then press the Back Button on the phone, we will go back to LoginActivity. That doesn't make any sense, because we are logged in.
How can I check in LoginActivity if we came from Back Button? I tried this code, but it doesnt help, because onCreate is not run when coming from Back Button.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
// Check if we are registered before, then just go to Main
checkIfWeAreRegistered();
}