Called when a tab that is already selected is chosen again by the user. Some applications may use this action to return to the top level of a category.
FragmentTransaction!: A FragmentTransaction for queuing fragment operations to execute once this method returns. This FragmentTransaction does not support being added to the back stack.
FragmentTransaction!: A FragmentTransaction for queuing fragment operations to execute during a tab switch. The previous tab's unselect and this tab's select will be executed in a single transaction. This FragmentTransaction does not support being added to the back stack.
FragmentTransaction!: A FragmentTransaction for queuing fragment operations to execute during a tab switch. This tab's unselect and the newly selected tab's select will be executed in a single transaction. This FragmentTransaction does not support being added to the back stack.
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.TabListener\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\nTabListener\n===========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/ActionBar.TabListener \"View this page in Java\") \n\n```\ninterface TabListener\n```\n\n|----------------------------------------|\n| [android.app.ActionBar.TabListener](#) |\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\nCallback interface invoked when a tab is focused, unfocused, added, or removed.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onTabReselected](#onTabReselected(android.app.ActionBar.Tab,%20android.app.FragmentTransaction))`(`tab:` `[ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!`, `ft:` `[FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!`)` Called when a tab that is already selected is chosen again by the user. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onTabSelected](#onTabSelected(android.app.ActionBar.Tab,%20android.app.FragmentTransaction))`(`tab:` `[ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!`, `ft:` `[FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!`)` Called when a tab enters the selected state. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onTabUnselected](#onTabUnselected(android.app.ActionBar.Tab,%20android.app.FragmentTransaction))`(`tab:` `[ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!`, `ft:` `[FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!`)` Called when a tab exits the selected state. |\n\nPublic methods\n--------------\n\n### onTabReselected\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onTabReselected(\n tab: ActionBar.Tab!, \n ft: FragmentTransaction!\n): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCalled when a tab that is already selected is chosen again by the user. Some applications may use this action to return to the top level of a category.\n\n| Parameters ||\n|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tab` | [ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!: The tab that was reselected. |\n| `ft` | [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!: A [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction) for queuing fragment operations to execute once this method returns. This FragmentTransaction does not support being added to the back stack. |\n\n### onTabSelected\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onTabSelected(\n tab: ActionBar.Tab!, \n ft: FragmentTransaction!\n): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCalled when a tab enters the selected state.\n\n| Parameters ||\n|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tab` | [ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!: The tab that was selected |\n| `ft` | [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!: A [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction) for queuing fragment operations to execute during a tab switch. The previous tab's unselect and this tab's select will be executed in a single transaction. This FragmentTransaction does not support being added to the back stack. |\n\n### onTabUnselected\n\nAdded in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onTabUnselected(\n tab: ActionBar.Tab!, \n ft: FragmentTransaction!\n): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCalled when a tab exits the selected state.\n\n| Parameters ||\n|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tab` | [ActionBar.Tab](/reference/kotlin/android/app/ActionBar.Tab)!: The tab that was unselected |\n| `ft` | [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction)!: A [FragmentTransaction](/reference/kotlin/android/app/FragmentTransaction) for queuing fragment operations to execute during a tab switch. This tab's unselect and the newly selected tab's select will be executed in a single transaction. This FragmentTransaction does not support being added to the back stack. |"]]