Actually you need to add smiles to the android application in the EditText and RecyclerView fields. Are there any existing libraries?
3 answers
Library is not needed. Smilies that you have available on your phone are encoded in UNICODE. All you need to do is translate the correct unicode ( int ) into a string. Here is a resource for all smiles from Unicode.
Unicode translation into smiley string (code on cotlin)
fun getEmojiByUnicode(unicode: Int): String = String(Character.toChars(unicode)) If unicode comes in the form of a string, you can convert it to an int like this:
Integer.parseInt("юникод без превикса U+", 16) Although the answer of Paul is very correct and accurate (I voted for him), I will allow myself to expand it a little more:
Replace http://apps.timwhitlock.info/emoji/tables/unicode 'U +' from this table with '0x'. For example, 'U+1F60A' on '0x1F60A' .
So you get an int
int unicode = 0x1F60A; Then, you can do this method:
public String getEmojiByUnicode(int unicode){ return new String(Character.toChars(unicode)); } In TextView (or in EditText) you will see 😊 without Drawable
// Create spannable text and set style. Spannable text = new SpannableString("This is underline and bold text."); text.setSpan(new UnderlineSpan(), 8, 17, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); text.setSpan(new StyleSpan(Typeface.BOLD), 22, 26, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); // Set spannable text in TextView. TextView textView = (TextView) findViewById(R.id.text); textView.setText(text); http://developer.alexanderklimov.ru/android/theory/spannable.php