Android local language and multi-country language support

Source: Internet
Author: User
Android has attributes related to multi-language support. Use the following Code Print system-related property values. For specific attributes, see the document. Package COM. example; import android. app. activity; import android. content. res. configuration; import android. OS. bundle; import android. widget. textview; import Org. w3C. dom. text; import Java. util. locale; public class myactivity extends activity {
@ Overridepublic void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
Locale locale = This. getresources (). getconfiguration (). locale;
Stringbuffer sb = new stringbuffer ();
SB. append ("locale. tostring ():" + locale. tostring ());
SB. append ("\ nlocale. getcountry ():" + locale. getcountry ());
SB. append ("\ nlocale. getdisplaycountry ():" + locale. getdisplaycountry ());
SB. append ("\ nlocale. getdisplaylanguage ():" + locale. getdisplaylanguage ());
SB. append ("\ nlocale. getdisplayname ():" + locale. getdisplayname ());
SB. append ("\ nlocale. getdisplayvariant ():" + locale. getdisplayvariant ());
SB. append ("\ nlocale. getiso3country ():" + locale. getiso3country ());
SB. append ("\ nlocale. getiso3language ():" + locale. getiso3language ());
SB. append ("\ nlocale. getlanguage ():" + locale. getlanguage ());
SB. append ("\ nlocale. getvariant ():" + locale. getvariant ());
Textview = (textview) This. findviewbyid (R. Id. Text );
Textview. settext (sb. tostring ());
This. settitle ("local object ");
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.