-1

I'm doing an Android app and I would know if this was possible: When the user press the return button, it does the same action as the home button.

Kara
  • 6,115
  • 16
  • 50
  • 57
qwertzuiop
  • 685
  • 2
  • 10
  • 24

1 Answers1

2

Following the question I linked: Override back button to act like home button:

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        moveTaskToBack(true);
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

Should be the solution.

This overrides the backbutton, and puts the task to the back. Which emulates hiding like the home button. Read the other question for more details, and solutions.

Community
  • 1
  • 1
IAmGroot
  • 13,760
  • 18
  • 84
  • 154