Stay organized with collections
Save and categorize content based on your preferences.
ActionBar.OnNavigationListener
public
static
interface
ActionBar.OnNavigationListener
android.app.ActionBar.OnNavigationListener
|
This interface was deprecated
in API level 21.
Action bar navigation modes are deprecated and not supported by inline
toolbar action bars. Consider using other
common
navigation patterns instead.
Listener interface for ActionBar navigation events.
Summary
Public methods |
abstract
boolean
|
onNavigationItemSelected(int itemPosition, long itemId)
This method is called whenever a navigation item in your action bar
is selected.
|
Public methods
onNavigationItemSelected
public abstract boolean onNavigationItemSelected (int itemPosition,
long itemId)
This method is called whenever a navigation item in your action bar
is selected.
Parameters |
itemPosition |
int : Position of the item clicked. |
itemId |
long : ID of the item clicked. |
Returns |
boolean |
True if the event was handled, false otherwise. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# ActionBar.OnNavigationListener\n\nAdded in [API level 11](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nDeprecated in [API level\n21](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nActionBar.OnNavigationListener\n==============================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/app/ActionBar.OnNavigationListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nActionBar.OnNavigationListener\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------|\n| android.app.ActionBar.OnNavigationListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\n**This interface was deprecated\nin API level 21.** \n\nAction bar navigation modes are deprecated and not supported by inline\ntoolbar action bars. Consider using other\n[common\nnavigation patterns](http://developer.android.com/design/patterns/navigation.html) instead.\n\nListener interface for ActionBar navigation events.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onNavigationItemSelected](/reference/android/app/ActionBar.OnNavigationListener#onNavigationItemSelected(int,%20long))`(int itemPosition, long itemId) ` This method is called whenever a navigation item in your action bar is selected. |\n\nPublic methods\n--------------\n\n### onNavigationItemSelected\n\nAdded in [API level 11](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onNavigationItemSelected (int itemPosition, \n long itemId)\n```\n\nThis method is called whenever a navigation item in your action bar\nis selected.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|---------------------------------------------|\n| `itemPosition` | `int`: Position of the item clicked. \u003cbr /\u003e |\n| `itemId` | `long`: ID of the item clicked. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|--------------------------------------------------------|\n| `boolean` | True if the event was handled, false otherwise. \u003cbr /\u003e |"]]