我在 Android TextView 中显示 emoji 图标时遇到了一些问题
首先,我在这里找到了 unicode 中的表情符号图标列表: http ://www.easyapns.com/category/just-for-fun
其次,我在这里找到了如何显示表情符号图标: https ://github.com/sharakova/EmojiTextView/blob/master/src/jp/sharakova/android/emoji/EmojiTextView.java
EmojiTextView.java 可以自动将预定义的字符转换为表情符号图标。因此,我想将字符串中所有出现的表情符号图标替换为某个预定义字符,并将结果放入 EmojiTextView.java 问题是我的代码无法识别包含表情符号图标的字符串中的表情符号图标。
这是我的代码片段-我正在尝试查找输入是否与表情符号图标的任何 unicode 匹配:
// Array list of all emoji icon
private static final String[] ArrayEUnicodeString ={
"\uE415",
"\uE056",
"\uE057",
...
}
// Nothing matched when it receive emoji icon with unicode "\uE415" from iphone. 'input' is message received from XMPP server
for (int i=0; i < emojiLength; i++)
{
if (input.getBytes() == ArrayEUnicodeString[i].getBytes())
Log.e("test", "ArrayEUnicodeString found");
}
// Note: iphone can display the emoji icon if I send "\uE415"
我不擅长 unicode 比较/约定。有人可以帮我吗,谢谢!