0

I have a very simple application. The app asks a question and depending on what the user clicks a different text is shown. Now, when the home button is pressed the phone goes to the home screen and the app pauses.

But when I press the back button the dialog goes away but the white background (Default in an app made by eclipse) is still there. Then I have to press the back button once more to get to the home screen.

My question, is there a way to make the back button act as the home button to return to the home screen? If there is, what is it.

I have tried using onStop and onResume and onPause but the same thing happens.

Thanks,

dhoehna.

Darren Hoehna
  • 269
  • 2
  • 8
  • 19

1 Answers1

0

Sounds like android SDK. So, I'm going to assume you are doing Android development. You'll have to override the method called OnBackPressed(). Then you can override the back button to do what you want it to do.

If Pollavith
  • 228
  • 2
  • 5
  • That is a wonderful idea but I am using a minSDKversion of three. The method was not there. Instead this is what I have been using public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { but what is the code to make it go back to the home screen? – Darren Hoehna Aug 05 '12 at 02:06
  • So I have tried moveTaskToBack(true) but the same thing still happens the dialog goes away but the white background still stays. Although I think what I need is somethign that moves the whole app to the background...but that is what moveTaskToBack() does right? – Darren Hoehna Aug 05 '12 at 02:41