11

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();  
Savan Akbari
  • 460
  • 1
  • 6
  • 13

1 Answers1

27

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

Pavan Bilagi
  • 1,618
  • 1
  • 18
  • 23