Stay organized with collections
Save and categorize content based on your preferences.
SpanWatcher
public
interface
SpanWatcher
implements
NoCopySpan
Known indirect subclasses
|
When an object of this type is attached to a Spannable, its methods
will be called to notify it that other markup objects have been
added, changed, or removed.
Summary
Public methods |
abstract
void
|
onSpanAdded(Spannable text, Object what, int start, int end)
This method is called to notify you that the specified object
has been attached to the specified range of the text.
|
abstract
void
|
onSpanChanged(Spannable text, Object what, int ostart, int oend, int nstart, int nend)
This method is called to notify you that the specified object
has been relocated from the range ostart…oend
to the new range nstart…nend of the text.
|
abstract
void
|
onSpanRemoved(Spannable text, Object what, int start, int end)
This method is called to notify you that the specified object
has been detached from the specified range of the text.
|
Public methods
onSpanAdded
public abstract void onSpanAdded (Spannable text,
Object what,
int start,
int end)
This method is called to notify you that the specified object
has been attached to the specified range of the text.
Parameters |
text |
Spannable |
what |
Object |
start |
int |
end |
int |
onSpanChanged
public abstract void onSpanChanged (Spannable text,
Object what,
int ostart,
int oend,
int nstart,
int nend)
This method is called to notify you that the specified object
has been relocated from the range ostart…oend
to the new range nstart…nend
of the text.
Parameters |
text |
Spannable |
what |
Object |
ostart |
int |
oend |
int |
nstart |
int |
nend |
int |
onSpanRemoved
public abstract void onSpanRemoved (Spannable text,
Object what,
int start,
int end)
This method is called to notify you that the specified object
has been detached from the specified range of the text.
Parameters |
text |
Spannable |
what |
Object |
start |
int |
end |
int |
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,["# SpanWatcher\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nSpanWatcher\n===========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/text/SpanWatcher \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nSpanWatcher\n`\n\n\n`\n\n\nimplements\n\n`[NoCopySpan](/reference/android/text/NoCopySpan)`\n\n\n`\n\n|--------------------------|\n| android.text.SpanWatcher |\n\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [MultiTapKeyListener](/reference/android/text/method/MultiTapKeyListener), [TextKeyListener](/reference/android/text/method/TextKeyListener) |---------------------------------------------------------------------------|-----------------------------------------------------------------------------| | [MultiTapKeyListener](/reference/android/text/method/MultiTapKeyListener) | This is the standard key listener for alphabetic input on 12-key keyboards. | | [TextKeyListener](/reference/android/text/method/TextKeyListener) | This is the key listener for typing normal text. | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nWhen an object of this type is attached to a Spannable, its methods\nwill be called to notify it that other markup objects have been\nadded, changed, or removed.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onSpanAdded](/reference/android/text/SpanWatcher#onSpanAdded(android.text.Spannable,%20java.lang.Object,%20int,%20int))`(`[Spannable](/reference/android/text/Spannable)` text, `[Object](/reference/java/lang/Object)` what, int start, int end) ` This method is called to notify you that the specified object has been attached to the specified range of the text. |\n| ` abstract void` | ` `[onSpanChanged](/reference/android/text/SpanWatcher#onSpanChanged(android.text.Spannable,%20java.lang.Object,%20int,%20int,%20int,%20int))`(`[Spannable](/reference/android/text/Spannable)` text, `[Object](/reference/java/lang/Object)` what, int ostart, int oend, int nstart, int nend) ` This method is called to notify you that the specified object has been relocated from the range `ostart...oend` to the new range `nstart...nend` of the text. |\n| ` abstract void` | ` `[onSpanRemoved](/reference/android/text/SpanWatcher#onSpanRemoved(android.text.Spannable,%20java.lang.Object,%20int,%20int))`(`[Spannable](/reference/android/text/Spannable)` text, `[Object](/reference/java/lang/Object)` what, int start, int end) ` This method is called to notify you that the specified object has been detached from the specified range of the text. |\n\nPublic methods\n--------------\n\n### onSpanAdded\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSpanAdded (Spannable text, \n Object what, \n int start, \n int end)\n```\n\nThis method is called to notify you that the specified object\nhas been attached to the specified range of the text.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|--------------------|\n| `text` | `Spannable` \u003cbr /\u003e |\n| `what` | `Object` \u003cbr /\u003e |\n| `start` | `int` \u003cbr /\u003e |\n| `end` | `int` \u003cbr /\u003e |\n\n### onSpanChanged\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSpanChanged (Spannable text, \n Object what, \n int ostart, \n int oend, \n int nstart, \n int nend)\n```\n\nThis method is called to notify you that the specified object\nhas been relocated from the range `ostart...oend`\nto the new range `nstart...nend` of the text.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------|--------------------|\n| `text` | `Spannable` \u003cbr /\u003e |\n| `what` | `Object` \u003cbr /\u003e |\n| `ostart` | `int` \u003cbr /\u003e |\n| `oend` | `int` \u003cbr /\u003e |\n| `nstart` | `int` \u003cbr /\u003e |\n| `nend` | `int` \u003cbr /\u003e |\n\n### onSpanRemoved\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onSpanRemoved (Spannable text, \n Object what, \n int start, \n int end)\n```\n\nThis method is called to notify you that the specified object\nhas been detached from the specified range of the text.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|--------------------|\n| `text` | `Spannable` \u003cbr /\u003e |\n| `what` | `Object` \u003cbr /\u003e |\n| `start` | `int` \u003cbr /\u003e |\n| `end` | `int` \u003cbr /\u003e |"]]