2

I have two activities A and B, to move from A to B you need to login. After I move to B I call finsih on A.

In B activity I call movetoBack when the back button is pressed. However when I recall my App it takes me back to A.

@Override
public void onBackPressed() {
    super.onBackPressed();
    moveTaskToBack (true);
}
Amanni
  • 1,924
  • 6
  • 31
  • 51
  • What happens if you reverse? @Override public void onBackPressed() { moveTaskToBack (true); super.onBackPressed(); } – Warpzit Jul 03 '12 at 14:49
  • if you call super.onBackPressed . it will behave as normaly it does. while overriding you must remove it. – Zar E Ahmer May 20 '14 at 12:08

1 Answers1

10

Don't call super, which invokes the default implementation of the BACK button...which is to call finish() on the current Activity. Just call moveTaskToBack() inside of your Override.

devunwired
  • 62,780
  • 12
  • 127
  • 139