Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/text/SpanWatcher#pubmethods)

# SpanWatcher

*** ** * ** ***


`
public


interface
SpanWatcher
`


`


implements

https://developer.android.com/reference/android/text/NoCopySpan


`

|---|
| android.text.SpanWatcher |

|---|
| Known indirect subclasses [MultiTapKeyListener](https://developer.android.com/reference/android/text/method/MultiTapKeyListener), [TextKeyListener](https://developer.android.com/reference/android/text/method/TextKeyListener) |---|---| | [MultiTapKeyListener](https://developer.android.com/reference/android/text/method/MultiTapKeyListener) | This is the standard key listener for alphabetic input on 12-key keyboards. | | [TextKeyListener](https://developer.android.com/reference/android/text/method/TextKeyListener) | This is the key listener for typing normal text. | |

<br />

*** ** * ** ***

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` | ` https://developer.android.com/reference/android/text/SpanWatcher#onSpanAdded(android.text.Spannable,%20java.lang.Object,%20int,%20int)(https://developer.android.com/reference/android/text/Spannable text, https://developer.android.com/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. |
| ` abstract void` | ` https://developer.android.com/reference/android/text/SpanWatcher#onSpanChanged(android.text.Spannable,%20java.lang.Object,%20int,%20int,%20int,%20int)(https://developer.android.com/reference/android/text/Spannable text, https://developer.android.com/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. |
| ` abstract void` | ` https://developer.android.com/reference/android/text/SpanWatcher#onSpanRemoved(android.text.Spannable,%20java.lang.Object,%20int,%20int)(https://developer.android.com/reference/android/text/Spannable text, https://developer.android.com/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. |

## Public methods

### onSpanAdded

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `text` | `Spannable` <br /> |
| `what` | `Object` <br /> |
| `start` | `int` <br /> |
| `end` | `int` <br /> |

### onSpanChanged

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `text` | `Spannable` <br /> |
| `what` | `Object` <br /> |
| `ostart` | `int` <br /> |
| `oend` | `int` <br /> |
| `nstart` | `int` <br /> |
| `nend` | `int` <br /> |

### onSpanRemoved

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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.

<br />

| Parameters ||
|---|---|
| `text` | `Spannable` <br /> |
| `what` | `Object` <br /> |
| `start` | `int` <br /> |
| `end` | `int` <br /> |