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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnNavigationListener\n====================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/ActionBar.OnNavigationListener \"View this page in Java\") \n\n```\ninterface OnNavigationListener\n```\n\n|-------------------------------------------------|\n| [android.app.ActionBar.OnNavigationListener](#) |\n\n*** ** * ** ***\n\n| **This interface was deprecated in API level 21.**\n|\n| Action bar navigation modes are deprecated and not supported by inline toolbar action bars. Consider using other [common navigation 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](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onNavigationItemSelected](#onNavigationItemSelected(kotlin.Int,%20kotlin.Long))`(`itemPosition:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `itemId:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` 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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onNavigationItemSelected(\n itemPosition: Int, \n itemId: Long\n): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nThis method is called whenever a navigation item in your action bar is selected.\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------------------------------------|\n| `itemPosition` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Position of the item clicked. |\n| `itemId` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): ID of the item clicked. |\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if the event was handled, false otherwise. |"]]