Mobile App Development

A new way to add emojis to your Android app

Posted by Lin Guo, Software Engineer

The use of emojis in communication has become increasingly popular in recent years. These small icons can be used to express a wide range of emotions and add a personal touch to messages. However, adding emojis to your Android app can be a bit of a challenge. This is where the Emoji Selection Library comes in. You can just add a few lines of code to your app and you can immediately start using emojis. It’s the easiest way to get started with emojis, and it will make your app more fun and expressive.

Animated image of using EmojiPicker on Google Pixel 6 Pro
Figure 1. Emoticon picker

Some useful features provided by the library

Updated emojis without tofu (☐)

Every year new versions of emojis are released, and we will regularly update the library to offer these new emojis. High-end phones will be able to render these new emojis without any problem. For low-end phones, the newer emoji may be displayed as a small square box called Tofu (☐). The library guarantees to detect and remove them. This ensures that the library is compatible across multiple Android versions/devices.

Smooth user interface

The library has several optimizations that attempt to reduce startup latency and speed up the scrolling experience, such as caching rendered emojis, drawing emojis asynchronously, and RecyclerView optimizations.

Personalized inclusive experience

User selections are persistent in the library. Newly chosen emojis will be displayed in the top row, making it easier for users to find and share them. The library also offers a variety of emojis that represent different people and cultures in the variant panels. If the user chooses an emoji from one of the variations panels (Figure 2), the choice is retained and defaulted to the main panel.

Image showing the variety of characters to choose from in EmojiPicker
Figure 2. Emoji Variant

Integrate the emoji picker into your app in 3 steps

Step 1: Import the library into build.gradle

dependencies {
implementation "androidx.emoji2:emojipicker:$version"

Step 2: Inflate it EmojiPickerView

Optionally set emojiGridColumns And emojiGridLines depending on the desired size of each emoji cell

An example that uses EmojiPickerView in XML


app:emojiGridColumns="9" />

A very simple emoji picker should now be featured on your app! For the next step, we assume that you want to do something with the chosen emoji.

Step 3: Provide the listener with the chosen emoji

emojiPickerView.setOnEmojiPickedListener {

You now have a basic working emoji picker. To customize it further (e.g. replacing some styles or providing different behavior from the recent emojis line), please refer to our APIs And application example.

Do not hesitate to file a bug report or feature request to help us improve the library!

Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button