I am working on a chat application where i am implementing emoji but i have one question in adapter how to render the emoji in a Textview.
emocationGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
emoDrawables.get(position).setBounds(0, 0, emoDrawables.get(position).getIntrinsicWidth(),
emoDrawables.get(position).getIntrinsicHeight());
int selectionCursor = chatMsgEtd.getSelectionStart();
chatMsgEtd.getText().insert(selectionCursor, ".");
selectionCursor = chatMsgEtd.getSelectionStart();
SpannableStringBuilder builder = new SpannableStringBuilder(chatMsgEtd.getText());
builder.setSpan(new ImageSpan(emoDrawables.get(position)), selectionCursor - ".".length(),
selectionCursor, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
chatMsgEtd.setText(builder);
chatMsgEtd.setSelection(selectionCursor);
}
});
Adapter
chatMsgTxt.setText(chats.get(position).getMessage());
So in the adapter the getMessage is the chat message but here how to render the emoji with message.
Please go through my post and suggest me some solution.