Stay organized with collections
Save and categorize content based on your preferences.
TextView.OnEditorActionListener
public
static
interface
TextView.OnEditorActionListener
android.widget.TextView.OnEditorActionListener
|
Interface definition for a callback to be invoked when an action is
performed on the editor.
Summary
Public methods
onEditorAction
public abstract boolean onEditorAction (TextView v,
int actionId,
KeyEvent event)
Called when an action is being performed.
Parameters |
v |
TextView : The view that was clicked. |
actionId |
int : Identifier of the action. This will be either the
identifier you supplied, or EditorInfo.IME_NULL if being called due to the enter key
being pressed. Starting from Android 14, the action identifier will
also be included when triggered by an enter key if the input is
constrained to a single line. |
event |
KeyEvent : If triggered by an enter key, this is the event;
otherwise, this is null. |
Returns |
boolean |
Return true if you have consumed the action, 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,["# TextView.OnEditorActionListener\n\nAdded in [API level 3](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nTextView.OnEditorActionListener\n===============================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/widget/TextView.OnEditorActionListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nTextView.OnEditorActionListener\n`\n\n\n`\n\n\n`\n\n|------------------------------------------------|\n| android.widget.TextView.OnEditorActionListener |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when an action is\nperformed on the editor.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[onEditorAction](/reference/android/widget/TextView.OnEditorActionListener#onEditorAction(android.widget.TextView,%20int,%20android.view.KeyEvent))`(`[TextView](/reference/android/widget/TextView)` v, int actionId, `[KeyEvent](/reference/android/view/KeyEvent)` event) ` Called when an action is being performed. |\n\nPublic methods\n--------------\n\n### onEditorAction\n\nAdded in [API level 3](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean onEditorAction (TextView v, \n int actionId, \n KeyEvent event)\n```\n\nCalled when an action is being performed.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `v` | `TextView`: The view that was clicked. \u003cbr /\u003e |\n| `actionId` | `int`: Identifier of the action. This will be either the identifier you supplied, or [EditorInfo.IME_NULL](/reference/android/view/inputmethod/EditorInfo#IME_NULL) if being called due to the enter key being pressed. Starting from Android 14, the action identifier will also be included when triggered by an enter key if the input is constrained to a single line. \u003cbr /\u003e |\n| `event` | `KeyEvent`: If triggered by an enter key, this is the event; otherwise, this is null. \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-----------------------------------------------------------------|\n| `boolean` | Return true if you have consumed the action, else false. \u003cbr /\u003e |"]]