Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Display Emoticons/Emoji in Snackbar or Toast / Textview [duplicate]

I am trying to add emoticons/emoji in Snackbar/Toast notification. Do this emoticons need to be image resource or Unicode character. I am getting string output when i use unicode character from following website Unicode Character Website.

Snackbar.make(findViewById(android.R.id.content), \U+1F601 + "Done", Snackbar.LENGTH_LONG).show();  
like image 763
Savan Akbari Avatar asked Dec 31 '15 03:12

Savan Akbari


1 Answers

After cross referencing Supported Unicode Sequences as well as the Visual Unicode Database I realized that \u1F601 was a 32 bit Unicode representation, and the 16bit representation can be set like :

Toast.makeText(this, "Smileys = " + ("\ud83d\ude01"),Toast.LENGTH_LONG).show();

Change the last digit of ("\ud83d\ude01")unicode to change the smiley

Refer these links

http://apps.timwhitlock.info/emoji/tables/unicode#note1

http://www.charbase.com/1F601

like image 168
Pavan Bilagi Avatar answered Sep 29 '22 08:09

Pavan Bilagi