0

I'm doing an appication under phonegap (more specific in android). How can I disable the home, menu and back buttons in the screen, the idea is when i press any of the buttons, show a verification dialog, if the answer is correct, close the app. When i assign the function button doesn't show the dialog

fsalazar_sch
  • 348
  • 2
  • 6
  • 17
  • Here are 2 posts that may help you: [Back button](http://stackoverflow.com/questions/12791324/how-do-i-disable-android-back-button-on-one-page-and-change-to-exit-button-on-ev) and [Menu](http://stackoverflow.com/questions/12003757/disabling-menu-button-in-android-using-phonegap) – JpCrow May 16 '15 at 15:37

1 Answers1

1

For the home menu remove the onCreateOptionsMenu() function and also you wouldn't need the onOptionsItemSelected() function, so to hide the menu remove these two.

For the back buttons there are two of them:

The hard button in device that navigates in the app until it hits the main activity then pops out of the app, can be controlled by overriding this method onBackPressed()

And the one in the action bar that navigates all inside the app itself but never pops the user out of the app, can be set by setDisplayHomeAsUpEnabled() which takes a Boolean true to make it working, false to disable it.

Mohammad Saad
  • 44
  • 1
  • 5