Wednesday, September 6, 2023
HomeMobileA New Option to Add Emojis to Your Android App

A New Option to Add Emojis to Your Android App



Posted by Lin Guo, Software program Engineer

Using emojis in communication has develop into more and more in style in recent times. These small icons can be utilized to precise a variety of feelings and may add a private contact to messages. Nevertheless, including emojis to your Android app generally is a little bit of a problem. That is the place the Emoji picker library is available in. You may merely add a couple of strains of code to your app, and you’ll begin utilizing emojis immediately. It is the simplest solution to get began with emojis, and it’ll make your app extra enjoyable and expressive.

Moving image of using EmojiPicker on Google Pixel 6 Pro
Determine 1. Emoji Picker

Some helpful options supplied by the library

Up-to-date emojis with out tofu (☐)

Yearly, new emoji variations are printed, and we’ll repeatedly replace the library to offer these new emojis. Greater-end telephones will be capable of render these newer emojis with none drawback. For lower-end telephones, newer emoji could also be displayed as a small sq. field referred to as tofu (☐). The library ensures to detect and take away them. This ensures the library is appropriate throughout a number of Android variations/gadgets.

Easy UI

The library has a number of optimizations that try to scale back startup latency and pace up scrolling expertise, resembling caching renderable emojis, drawing emojis asynchronously and RecyclerView optimizations.

Personalised inclusive expertise

Consumer alternatives are persistent within the library. Emojis which are newly chosen can be proven on the prime row, making it easier for customers to seek out and share them. The library additionally presents quite a lot of emojis that signify completely different individuals and cultures within the variant panels. If the consumer chooses an emoji from one of many variation panels (Determine 2), the selection is retained and set because the default in the principle panel.

Image showijng diversity of characters to choose from in EmojiPicker
Determine 2. Emoji variants

Combine emoji picker into your app in 3 steps

Step 1: Import the library in construct.gradle 

dependencies {
implementation "androidx.emoji2:emojipicker:$model"
}

Step 2: Inflate the EmojiPickerView

Optionally set emojiGridColumns and emojiGridRows based mostly on the specified measurement of every emoji cell

An instance that makes use of EmojiPickerView in XML

<androidx.emoji2.emojipicker.EmojiPickerView

app:emojiGridColumns="9" />

A quite simple emoji picker ought to now be introduced in your app! For the subsequent step, we assume you want to do one thing to the picked emoji.

Step 3: Present listener to the picked emoji


emojiPickerView.setOnEmojiPickedListener {
findViewById<EditText>(R.id.edit_text).append(it.emoji)
}

Now you have got a primary functioning emoji picker. To customise it additional (e.g, override some kinds or present a unique conduct to the current emoji row), please check with our api and pattern app.

Be happy to file Bug Report or Characteristic Request to assist us enhance the library!




Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments