Help in a simple (or not) aplication


Last Updated:

  1. IGSG

    IGSG New Member

    Hey everyone!
    It's nice to be a new member in this community!

    I'm beginner at android development and i start development an application and i need your help, please.
    What i want to do is an app that just shows one button, at the end of the button, it should appear a country flag, this country flag must be the flag of the country language of the phone. By clicking in the button. it will open a website in the default mobile language(correspondig to the flag). If we want to open the website in other language, we should click beside the country flag an it will appears other country flags that we can click.
    The code to open the website is ok, my biggest dificults are to know the default language of the phone and in function of this, put the flag after the button and make the menu beside the flag in case we want open site in other language. How i would make the mail.xml contains the squeme is other problem.


    [​IMG]


    If someone could help me, i will be very grateful.

    Advertisement
  2. markb

    markb Well-Known Member

    The java.util.Locale class might be of use to you.

    Locale | Android Developers)

    Code (Text):
    1.  
    2. Locale locale = Locale.getDefault() ;
    3.  
    4. Log.d(TAG, "Locale getCountry = "+locale.getCountry()) ;
    5. Log.d(TAG, "Locale getDisplayCountry = "+locale.getDisplayCountry()) ;
    6. Log.d(TAG, "Locale getISO3Country = "+locale.getISO3Country()) ;
    7. Log.d(TAG, "Locale getLanguage = "+locale.getLanguage()) ;
    8. Log.d(TAG, "Locale getgetDisplayLanguage = "+locale.getDisplayLanguage()) ;
    9.  
    I get the following results, which are correct for me:

    Code (Text):
    1.  
    2. Locale getCountry = GB
    3. Locale getDisplayCountry = United Kingdom
    4. Locale getISO3Country = GBR
    5. Locale getLanguage = en
    6. Locale getgetDisplayLanguage = English
    7.  
    Mark

Share This Page