Stay organized with collections
Save and categorize content based on your preferences.
OnContextClickListener
interface OnContextClickListener
The listener that is used to notify when a context click occurs. When listening for a context click ensure that you call onGenericMotionEvent(android.view.MotionEvent)
in View.onGenericMotionEvent(MotionEvent)
.
Summary
Public methods |
abstract Boolean |
Notified when a context click occurs.
|
Public methods
onContextClick
abstract fun onContextClick(e: MotionEvent): Boolean
Notified when a context click occurs.
Parameters |
e |
MotionEvent: The motion event that occurred during the context click. This value cannot be null . |
Return |
Boolean |
true if the event is consumed, else false |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# GestureDetector.OnContextClickListener\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnContextClickListener\n======================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/GestureDetector.OnContextClickListener \"View this page in Java\") \n\n```\ninterface OnContextClickListener\n```\n\n|----------------------------------------------------------|\n| [android.view.GestureDetector.OnContextClickListener](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [GestureDetector.SimpleOnGestureListener](/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener) |-------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------| | [GestureDetector.SimpleOnGestureListener](/reference/kotlin/android/view/GestureDetector.SimpleOnGestureListener) | A convenience class to extend when you only want to listen for a subset of all the gestures. | |\n\nThe listener that is used to notify when a context click occurs. When listening for a context click ensure that you call [onGenericMotionEvent(android.view.MotionEvent)](/reference/kotlin/android/view/GestureDetector#onGenericMotionEvent(android.view.MotionEvent)) in [View.onGenericMotionEvent(MotionEvent)](/reference/kotlin/android/view/View#onGenericMotionEvent(android.view.MotionEvent)).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onContextClick](#onContextClick(android.view.MotionEvent))`(`e:` `[MotionEvent](/reference/kotlin/android/view/MotionEvent)`)` Notified when a context click occurs. |\n\nPublic methods\n--------------\n\n### onContextClick\n\nAdded in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onContextClick(e: MotionEvent): Boolean\n```\n\nNotified when a context click occurs.\n\n| Parameters ||\n|-----|--------------------------------------------------------------------------------------------------------------------------------------------------|\n| `e` | [MotionEvent](/reference/kotlin/android/view/MotionEvent): The motion event that occurred during the context click. This value cannot be `null`. |\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the event is consumed, else false |"]]