Try this one

String languageToLoad  = "cn";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());

This would load chinese, for more information on what's happening
here
http://almondmendoza.com/2009/01/28/force-localize-an-application-on-android/

On Jan 4, 5:05 am, EvgenyV <[email protected]> wrote:
> Just make sure I'm not missing something...
>
> I have some code:
> public class MyLangTest extends Activity {
>
> @Override
> public void onCreate(Bundle icicle)
> {
> super.onCreate(icicle);
>
> String fromResources = getResources().getString(r.string.f_name);
>
> //Displayed
> "First Name"
>
> Locale newLocale = new Locale("cs", "CZ");
> Locale.setDefault(newLocale)
>
> String fromResourcesLang = getResources().getString(r.string.f_name);
> //Expected "First Name Other Language"
> //But in fact still displayed "First Name"
>
> }
> }
>
> default xml
> values\
> <string name="f_name">First Name</string>
> values-cs-rCZ\
> <string name="f_name">First Name Other Language</string>
>
> When I'm watchig this.mCurrentConfig.locale value is still en_US
> Is it my mistake or SDK doesn't support this locale changes?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to