• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Help in a simple (or not) aplication

IGSG

Lurker
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.





If someone could help me, i will be very grateful.
 
The java.util.Locale class might be of use to you.

Locale | Android Developers)

Code:
Locale locale = Locale.getDefault() ;

Log.d(TAG, "Locale getCountry = "+locale.getCountry()) ;
Log.d(TAG, "Locale getDisplayCountry = "+locale.getDisplayCountry()) ;
Log.d(TAG, "Locale getISO3Country = "+locale.getISO3Country()) ;
Log.d(TAG, "Locale getLanguage = "+locale.getLanguage()) ;
Log.d(TAG, "Locale getgetDisplayLanguage = "+locale.getDisplayLanguage()) ;

I get the following results, which are correct for me:

Code:
Locale getCountry = GB
Locale getDisplayCountry = United Kingdom
Locale getISO3Country = GBR
Locale getLanguage = en
Locale getgetDisplayLanguage = English

Mark
 
Back
Top Bottom