Nouman Ghaffar
Nouman Ghaffar

Reputation: 137

Android Emoticons Implementation

Hello everyone , I am developing an application which required implementation of emoticons ( smiley). I can replace specific strings with drawable but it would be very time consuming. Is there any we to use system built in emoticons or some library to shorten my work? What I want is when I send text like this :) , the receiver get emoticon. Or when I send an emoticon he will get the same. Getting android system emoticons can help me too much.Your help would be great favor for me. Thanks

Upvotes: 3

Views: 1570

Answers (1)

Josef E.
Josef E.

Reputation: 2219

Emoji is a list of unicode emoticons which has a github that can implement emoticons into code (Found here).

From there you could use regex(\ue415\ue056\ue057) to find them or build them by char array (below).


Example:

StringBuilder sb = new StringBuilder();
for (char curr : str.toCharArray()) {
    sb.append((SUPPORTED_EMOJI_SET.contains(curr)) ? convertCharToImgTag(curr) : curr);
}

where SUPPORTED_EMOJI_SET is just a set of chars, for example:

new HashSet<Character>() {{
    add('\ue415');
    add('\ue056');
    ...
}}

For more ideas: go here!

Upvotes: 1

Related Questions