title: Country flag emoji not getting using country code in
body: <p>I want to get country flag using country code which should be supported to all versions from <code>API 19 to API 28</code>. For that i searched lot and found answer and i picked the code which was marked as accepted answer.</p>
  
  <p>I am using code from that answer</p>
  
  <pre><code> private String localeToEmoji(Locale locale) {
      String countryCode = locale.getCountry();
      Log.v("Asdasdasdasd", countryCode+" ; "+locale.getDisplayCountry());
      int firstLetter = Character.codePointAt(countryCode.toUpperCase(), 0) - 0x41 + 0x1F1E6;
      int secondLetter = Character.codePointAt(countryCode.toUpperCase(), 1) - 0x41 + 0x1F1E6;
      return new String(Character.toChars(firstLetter)) + new String(Character.toChars(secondLetter));
  }
  </code></pre>
  
  <p>I am using this function by,</p>
  
  <pre><code> Locale current = ConfigurationCompat.getLocales(getResources().getConfiguration()).get(0);
   txt.setText(localeToEmoji(current));
  </code></pre>
  
  <p>But this is not working in <code>Kitkat</code> and <code>Lollipop</code>. It just showing country code not country flag. I have tested in both devices now.</p>
  
  <p>So what is the best way to retrieve country flag using country code.</p>
  
  <p>Advanced help would be appreciated!</p>