Android Question Emoji

Discussion in 'Android Questions' started by samperizal, Aug 8, 2019.

  1. samperizal

    samperizal Active Member Licensed 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
     
  2. Jeffrey Cameron

    Jeffrey Cameron Active Member Licensed User

  3. samperizal

    samperizal Active Member Licensed 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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    More information please. What is the input and the expected output?
     
  5. emexes

    emexes Well-Known Member Licensed User

    Try:
    Code:
    Dim TryFlag As String = Chr(0x1f1ea) & Chr(0x1f1e6) & " might work"
    Log(TryFlag)    'or assign to Label .Text
     
    José J. Aguilar likes this.
  6. emexes

    emexes Well-Known Member Licensed User

    Or Chr(0x1f1ea) & Chr(0x1f1f8)
     
  7. samperizal

    samperizal Active Member Licensed User

    Hi. What I want to do is put in a Sting the flag of Spain.

    Thank you.


    . Sorry for my English
     
  8. emexes

    emexes Well-Known Member 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.
     
    Shelby likes this.
  9. samperizal

    samperizal Active Member Licensed User

    Hi. Yes. I tried the previous chr and it didn't work for me.
    P.s excuse my English
     
    Shelby likes this.
  10. emexes

    emexes Well-Known Member Licensed User

    Ah, well, was worth a go. I will try it myself when I get back home later today.
     
    Shelby likes this.
  11. Jeffrey Cameron

    Jeffrey Cameron Active Member Licensed 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).
     
    DonManfred likes this.
  12. samperizal

    samperizal Active Member Licensed User

    Thanks. It shows nothing. I'm going to try other unicode
     
  13. emexes

    emexes Well-Known Member Licensed User

    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/
     
    Jeffrey Cameron and Shelby like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice