Skip to content

Most visited

Recently visited

navigation

EmojiEditText

public class EmojiEditText
extends EditText

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.EditText
         ↳ android.support.text.emoji.widget.EmojiEditText


EditText widget enhanced with emoji capability by using EmojiEditTextHelper. When used on devices running API 18 or below, this widget acts as a regular EditText.

Summary

Inherited XML attributes

From class android.widget.TextView
From class android.view.View

Inherited constants

From class android.widget.TextView
From class android.view.View

Inherited fields

From class android.view.View

Public constructors

EmojiEditText(Context context)
EmojiEditText(Context context, AttributeSet attrs)
EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr)
EmojiEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

int getMaxEmojiCount()

Returns the maximum number of EmojiSpans to be added to a CharSequence.

InputConnection onCreateInputConnection(EditorInfo outAttrs)

Create a new InputConnection for an InputMethod to interact with the view.

void setKeyListener(KeyListener keyListener)

Sets the key listener to be used with this TextView.

void setMaxEmojiCount(int maxEmojiCount)

Set the maximum number of EmojiSpans to be added to a CharSequence.

Inherited methods

From class android.widget.EditText
From class android.widget.TextView
From class android.view.View
From class java.lang.Object
From interface android.view.ViewTreeObserver.OnPreDrawListener
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.accessibility.AccessibilityEventSource

Public constructors

EmojiEditText

EmojiEditText (Context context)

Parameters
context Context

EmojiEditText

EmojiEditText (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

EmojiEditText

EmojiEditText (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

EmojiEditText

EmojiEditText (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

defStyleRes int

Public methods

getMaxEmojiCount

int getMaxEmojiCount ()

Returns the maximum number of EmojiSpans to be added to a CharSequence.

Returns
int

See also:

onCreateInputConnection

InputConnection onCreateInputConnection (EditorInfo outAttrs)

Create a new InputConnection for an InputMethod to interact with the view. The default implementation returns null, since it doesn't support input methods. You can override this to implement such support. This is only needed for views that take focus and text input.

When implementing this, you probably also want to implement onCheckIsTextEditor() to indicate you will return a non-null InputConnection.

Also, take good care to fill in the EditorInfo object correctly and in its entirety, so that the connected IME can rely on its values. For example, initialSelStart and initialSelEnd members must be filled in with the correct cursor position for IMEs to work correctly with your application.

Parameters
outAttrs EditorInfo: Fill in with attribute information about the connection.

Returns
InputConnection

setKeyListener

void setKeyListener (KeyListener keyListener)

Sets the key listener to be used with this TextView. This can be null to disallow user input. Note that this method has significant and subtle interactions with soft keyboards and other input method: see KeyListener.getContentType() for important details. Calling this method will replace the current content type of the text view with the content type returned by the key listener.

Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call setFocusable(boolean) again after calling this to get the focusability back the way you want it.

Parameters
keyListener KeyListener

setMaxEmojiCount

void setMaxEmojiCount (int maxEmojiCount)

Set the maximum number of EmojiSpans to be added to a CharSequence. The number of spans in a CharSequence affects the performance of the EditText insert/delete operations. Insert/delete operations slow down as the number of spans increases.

Parameters
maxEmojiCount int: maximum number of EmojiSpans to be added to a single CharSequence, should be equal or greater than 0

See also:

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.