Android Get Country Emoji Flag Using Locale

后端 未结 6 2022
难免孤独
难免孤独 2021-01-04 05:31

I have seen that since Lollipop, Android has built in Emoji flags for different countries. Is it possible to use the devices locale to retrieve the

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-04 05:47

    I am using this so easily. Get the Unicode from here.

    For Bangladesh flag it is U+1F1E7 U+1F1E9 Now,

    {...
    
     String flag = getEmojiByUnicode(0x1F1E7)+getEmojiByUnicode(0x1F1E9)+ " Bangladesh";
        }
        public String getEmojiByUnicode(int unicode){
            return new String(Character.toChars(unicode));
        }
    

    It will show > (Bangladeshi flag) Bangladesh

提交回复
热议问题