# EmojiSpan

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-emoji:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#)  

# EmojiSpan

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


abstract
class
EmojiSpan
`  
`


``


``


``

extends `[ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html)`


``


`

|---|---|---|---|--------------------------------------|
| java.lang.Object                                 |||||
| ↳ | [android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) ||||
|   | ↳ | [android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html) |||
|   |   | ↳ | [android.text.style.ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html) ||
|   |   |   | ↳ | android.support.text.emoji.EmojiSpan |

<br />

*** ** * ** ***

Base span class for the emoji replacement. When an emoji is found and needs to be replaced in a CharSequence, an instance of this class is added to the CharSequence.

## Summary

|                                                                                                                                                                                                                      ### Public methods                                                                                                                                                                                                                      ||
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int` | ` `[getSize](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#getSize(android.graphics.Paint, java.lang.CharSequence, int, int, android.graphics.Paint.FontMetricsInt))`(`[Paint](https://developer.android.com/reference/android/graphics/Paint.html)` paint, CharSequence text, int start, int end, `[Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt.html)` fm) ` |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#)From class` `[android.text.style.ReplacementSpan](https://developer.android.com/reference/android/text/style/ReplacementSpan.html)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` draw(`[Canvas](https://developer.android.com/reference/android/graphics/Canvas.html)` arg0, CharSequence arg1, int arg2, int arg3, float arg4, int arg5, int arg6, int arg7, `[Paint](https://developer.android.com/reference/android/graphics/Paint.html)` arg8) ` | | ` abstract int`  | ` getSize(`[Paint](https://developer.android.com/reference/android/graphics/Paint.html)` arg0, CharSequence arg1, int arg2, int arg3, `[Paint.FontMetricsInt](https://developer.android.com/reference/android/graphics/Paint.FontMetricsInt.html)` arg4) `            | | ` void`          | ` updateDrawState(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint.html)` arg0) `                                                                                                                                                          | | ` void`          | ` updateMeasureState(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint.html)` arg0) `                                                                                                                                                       | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#)From class` `[android.text.style.MetricAffectingSpan](https://developer.android.com/reference/android/text/style/MetricAffectingSpan.html)` ` |-----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------| | ` `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) | ` getUnderlying() `                                                                                             | | ` abstract void`                                                                                    | ` updateMeasureState(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint.html)` arg0) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#)From class` `[android.text.style.CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)` ` |------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------| | ` `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)        | ` getUnderlying() `                                                                                               | | ` abstract void`                                                                                           | ` updateDrawState(`[TextPaint](https://developer.android.com/reference/android/text/TextPaint.html)` arg0) `      | | ` static `[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html) | ` wrap(`[CharacterStyle](https://developer.android.com/reference/android/text/style/CharacterStyle.html)` arg0) ` | ||
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### getSize

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int getSize (Paint paint, 
                CharSequence text, 
                int start, 
                int end, 
                Paint.FontMetricsInt fm)
```

<br />

<br />

|               Parameters               ||
|---------|-------------------------------|
| `paint` | `Paint` <br />                |
| `text`  | `CharSequence` <br />         |
| `start` | `int` <br />                  |
| `end`   | `int` <br />                  |
| `fm`    | `Paint.FontMetricsInt` <br /> |

|    Returns    ||
|-------|--------|
| `int` | <br /> |

-

  ## Interfaces

  - [EmojiCompat.MetadataRepoLoader](https://developer.android.com/reference/android/support/text/emoji/EmojiCompat.MetadataRepoLoader)
-

  ## Classes

  - [EmojiCompat](https://developer.android.com/reference/android/support/text/emoji/EmojiCompat)
  - [EmojiCompat.Config](https://developer.android.com/reference/android/support/text/emoji/EmojiCompat.Config)
  - [EmojiCompat.InitCallback](https://developer.android.com/reference/android/support/text/emoji/EmojiCompat.InitCallback)
  - [EmojiCompat.MetadataRepoLoaderCallback](https://developer.android.com/reference/android/support/text/emoji/EmojiCompat.MetadataRepoLoaderCallback)
  - [EmojiSpan](https://developer.android.com/reference/android/support/text/emoji/EmojiSpan)
  - [FontRequestEmojiCompatConfig](https://developer.android.com/reference/android/support/text/emoji/FontRequestEmojiCompatConfig)
  - [FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy](https://developer.android.com/reference/android/support/text/emoji/FontRequestEmojiCompatConfig.ExponentialBackoffRetryPolicy)
  - [FontRequestEmojiCompatConfig.RetryPolicy](https://developer.android.com/reference/android/support/text/emoji/FontRequestEmojiCompatConfig.RetryPolicy)
  - [MetadataRepo](https://developer.android.com/reference/android/support/text/emoji/MetadataRepo)
  - [R](https://developer.android.com/reference/android/support/text/emoji/R)
  - [R.attr](https://developer.android.com/reference/android/support/text/emoji/R.attr)
  - [R.bool](https://developer.android.com/reference/android/support/text/emoji/R.bool)
  - [R.color](https://developer.android.com/reference/android/support/text/emoji/R.color)
  - [R.dimen](https://developer.android.com/reference/android/support/text/emoji/R.dimen)
  - [R.drawable](https://developer.android.com/reference/android/support/text/emoji/R.drawable)
  - [R.id](https://developer.android.com/reference/android/support/text/emoji/R.id)
  - [R.integer](https://developer.android.com/reference/android/support/text/emoji/R.integer)
  - [R.layout](https://developer.android.com/reference/android/support/text/emoji/R.layout)
  - [R.string](https://developer.android.com/reference/android/support/text/emoji/R.string)
  - [R.style](https://developer.android.com/reference/android/support/text/emoji/R.style)
  - [R.styleable](https://developer.android.com/reference/android/support/text/emoji/R.styleable)