Android Question Emoji

samperizal

Active Member
Licensed User
Longtime User
Hi, I have the following query, how can I put in an string an emogi that contains two or more codes in hexadecimal example
The flag of Spain x 0x1f1ea ox1f1e6 when it is of a single code is no problem any idea?

Thanks in advance.

PS Sorry for the English
 

samperizal

Active Member
Licensed User
Longtime User
Hi.
The link code works fine but how do I get the emoji from a flag that has two exa h decimal codes?

Thank you
 
Upvote 0

emexes

Expert
Licensed User
Did you try the Chr()s above, using the & operator to join multiple small Strings to be one large String?

If the flags are in the Unicode font used by the device to display the String then I am optimistic that it will work.
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
You're going to need to define what "didn't work for me" means. Is it not displaying the flag at all? If so then the font you're using may not support the Unicode characters you are trying to display (not all Unicode is universal).
 
Upvote 0

emexes

Expert
Licensed User
Thanks. It shows nothing.
Yep, I agree.

Unicode’s encoding of national flags is just crazy enough to work

I then thought perhaps it was more likely to to work on a PC than on a mobile device. Installed Google's Noto Emoji font downloaded from:

https://github.com/googlefonts/noto-emoji/blob/master/fonts/NotoEmoji-Regular.ttf

and in Chrome Settings, Customize fonts I set the Standard font to be Noto Emoji - make a note of the original setting, in case you need to set it back - then loaded this page:

https://esham.io/2015/04/emoji-flags-redux

and got this:

upload_2019-8-10_9-2-28.png


which is a step in the right direction. I tried using the colour version of the same font, but Windows 7 says it doesn't recognise that font format.

I suspect you will find that support for Unicode country flag characters/glyphs is still currently sporadic, and if you write your app based on this feature, then you will have many users without flags.

So you are probably better to use regular graphics at the moment. Wikipedia country entries might be a source of flag images. Or wikidata.org eg Spain, Australia (search for: flag image). Or this post points to an alternative and probably easier-to-access source of flag images and other country info.

https://www.b4x.com/android/forum/threads/country-codes-phones-codes.108292/#post-676928

B4X CharSequence type includes support for images, looks like it will do what you want but not via the (theoretically universal works-everywhere) Unicode method that you mentioned in this thread's first post.

https://www.b4x.com/android/forum/threads/charsequence-csbuilder-tutorial.76226/
Images
B4X:
Dim cs As CSBuilder
cs.Initialize.Size(30).Typeface(Typeface.MONOSPACE)
cs.Append("B4A: ").Image(LoadBitmap(File.DirAssets, "b4a.png"), 40dip, 40dip, False).Append(CRLF)
cs.Append("B4i: ").Image(LoadBitmap(File.DirAssets, "b4i.png"), 40dip, 40dip, False).Append(CRLF)
cs.Append("B4J: ").Image(LoadBitmap(File.DirAssets, "b4j.png"), 40dip, 40dip, False).Append(CRLF)
cs.Append("B4R: ").Image(LoadBitmap(File.DirAssets, "b4r.png"), 40dip, 40dip, False).Append(CRLF)
cs.PopAll
Label1.Text = cs
 
Upvote 0
Top