Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/text/style/MaskFilterSpan#pubctors) \| [Methods](https://developer.android.com/reference/android/text/style/MaskFilterSpan#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/text/style/MaskFilterSpan#inhmethods)

# MaskFilterSpan

*** ** * ** ***

` public class MaskFilterSpan `   
` ` ` extends https://developer.android.com/reference/android/text/style/CharacterStyle ` ` implements https://developer.android.com/reference/android/text/style/UpdateAppearance `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle) ||
|   | ↳ | android.text.style.MaskFilterSpan |

<br />

*** ** * ** ***

Span that allows setting a `https://developer.android.com/reference/android/graphics/MaskFilter` to the text it's attached to.

For example, to blur a text, a `https://developer.android.com/reference/android/graphics/BlurMaskFilter` can be used:

```
MaskFilter blurMask = new BlurMaskFilter(5f, BlurMaskFilter.Blur.NORMAL);
SpannableString string = new SpannableString("Text with blur mask");
string.setSpan(new MaskFilterSpan(blurMask), 10, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
```
![](https://developer.android.com/static/reference/android/images/text/style/maskfilterspan.png) Text blurred with the `MaskFilterSpan`.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/text/style/MaskFilterSpan#MaskFilterSpan(android.graphics.MaskFilter)(https://developer.android.com/reference/android/graphics/MaskFilter filter) ` Creates a `https://developer.android.com/reference/android/text/style/MaskFilterSpan` from a `https://developer.android.com/reference/android/graphics/MaskFilter`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/MaskFilter` | ` https://developer.android.com/reference/android/text/style/MaskFilterSpan#getMaskFilter()() ` Return the mask filter for this span. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/text/style/MaskFilterSpan#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/text/style/MaskFilterSpan#updateDrawState(android.text.TextPaint)(https://developer.android.com/reference/android/text/TextPaint ds) ` <br /> |

### Inherited methods

From class ` https://developer.android.com/reference/android/text/style/CharacterStyle ` ` https://developer.android.com/reference/android/text/style/CharacterStyle` ` https://developer.android.com/reference/android/text/style/CharacterStyle#getUnderlying()() `

Returns "this" for most CharacterStyles, but for CharacterStyles that were generated by `https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle)`, returns the underlying CharacterStyle.
` abstract void` ` https://developer.android.com/reference/android/text/style/CharacterStyle#updateDrawState(android.text.TextPaint)(https://developer.android.com/reference/android/text/TextPaint tp) ` ` static https://developer.android.com/reference/android/text/style/CharacterStyle` ` https://developer.android.com/reference/android/text/style/CharacterStyle#wrap(android.text.style.CharacterStyle)(https://developer.android.com/reference/android/text/style/CharacterStyle cs) `

A given CharacterStyle can only applied to a single region of a given Spanned.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### MaskFilterSpan

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

```
public MaskFilterSpan (MaskFilter filter)
```

Creates a `https://developer.android.com/reference/android/text/style/MaskFilterSpan` from a `https://developer.android.com/reference/android/graphics/MaskFilter`.

<br />

| Parameters ||
|---|---|
| `filter` | `MaskFilter`: the filter to be applied to the `TextPaint` <br /> |

## Public methods

### getMaskFilter

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

```
public MaskFilter getMaskFilter ()
```

Return the mask filter for this span.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/MaskFilter` | the mask filter for this span <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### updateDrawState

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

```
public void updateDrawState (TextPaint ds)
```

<br />

<br />

| Parameters ||
|---|---|
| `ds` | `TextPaint` <br /> |