Skip to main content
deleted 1 character in body
Source Link
zb22
  • 3.2k
  • 3
  • 20
  • 34

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your case the id for that section is "home"). and its not about the device buttons, its the menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your case the id for that section is "home"). and its not about the device buttons, its the menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it (in your case the id for that section is "home"). and its not about the device buttons, its the menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

edited body
Source Link
zb22
  • 3.2k
  • 3
  • 20
  • 34

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your codecase the id for that section is "home"). and its not about the device buttons, its athe menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your code the id for that section is "home"). and its not about the device buttons, its a menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your case the id for that section is "home"). and its not about the device buttons, its the menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed

Source Link
zb22
  • 3.2k
  • 3
  • 20
  • 34

We override onBackPressed in order to customise the action the way we want when the user press on the back button on its device.

In the other hand onOptionsItemSelected invoked when the user opens the menu and press on some section in it, (in your code the id for that section is "home"). and its not about the device buttons, its a menu in your app.

you can read more info about those methods:

onOptionsItemSelected
onBackPressed