Stay organized with collections
Save and categorize content based on your preferences.
OnCancelListener
interface OnCancelListener
Known Direct Subclasses
DialogFragment |
A fragment that displays a dialog window, floating on top of its activity's window.
|
SearchManager |
This class provides access to the system search services.
|
|
Interface used to allow the creator of a dialog to run some code when the dialog is canceled.
This will only be called when the dialog is canceled, if the creator needs to know when it is dismissed in general, use DialogInterface.OnDismissListener
.
Summary
Public methods |
abstract Unit |
This method will be invoked when the dialog is canceled.
|
Public methods
onCancel
abstract fun onCancel(dialog: DialogInterface!): Unit
This method will be invoked when the dialog is canceled.
Parameters |
dialog |
DialogInterface!: the dialog that was canceled will be passed into the method |
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,["# DialogInterface.OnCancelListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnCancelListener\n================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/content/DialogInterface.OnCancelListener \"View this page in Java\") \n\n```\ninterface OnCancelListener\n```\n\n|-------------------------------------------------------|\n| [android.content.DialogInterface.OnCancelListener](#) |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [DialogFragment](../app/DialogFragment.html#), [SearchManager](../app/SearchManager.html#) |-----------------------------------------------|-------------------------------------------------------------------------------------| | [DialogFragment](../app/DialogFragment.html#) | A fragment that displays a dialog window, floating on top of its activity's window. | | [SearchManager](../app/SearchManager.html#) | This class provides access to the system search services. | |\n\nInterface used to allow the creator of a dialog to run some code when the dialog is canceled.\n\nThis will only be called when the dialog is canceled, if the creator needs to know when it is dismissed in general, use [DialogInterface.OnDismissListener](/reference/kotlin/android/content/DialogInterface.OnDismissListener).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onCancel](#onCancel(android.content.DialogInterface))`(`dialog:` `[DialogInterface](/reference/kotlin/android/content/DialogInterface)!`)` This method will be invoked when the dialog is canceled. |\n\nPublic methods\n--------------\n\n### onCancel\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onCancel(dialog: DialogInterface!): Unit\n```\n\nThis method will be invoked when the dialog is canceled.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------|\n| `dialog` | [DialogInterface](/reference/kotlin/android/content/DialogInterface)!: the dialog that was canceled will be passed into the method |"]]