Try saving the locale some way, make your own implementation of
Application and change the locale in Application. Then when the users
wants a new locale, restart the activity/task.

On 12 mrt, 04:22, Stephen Le <[email protected]> wrote:
> Hi all:
>
> I must change en_US Locale into zh_CH dynamically(Like user choose
> it). I writed a demo where the code is following:
>
> public void onClick(View v){
>      Resources resource=super.getResources();
>      Configuration cf=resource.getConfiguration();
>      DisplayMetrics dm =resource.getDisplayMetrics();
>      cf.locale=Locale.CHINA;
>      resource.updateConfiguration(cf, dm);
>
> ((TextView)super.findViewById(R.id.usernamelabel)).setText
> ((super.getResources()).getString(R.string.username));
> ((TextView)super.findViewById(R.id.passwordlabel)).setText
> ((super.getResources()).getString(R.string.password));
> ((Button)super.findViewById(R.id.loginbutton)).setText
> ((super.getResources()).getString(R.string.loginbutton));
> ((Button)super.findViewById(R.id.cancelbutton)).setText
> ((super.getResources()).getString(R.string.cancel));
> ((Button)super.findViewById(R.id.i8nbutton)).setText
> ((super.getResources()).getString(R.string.i8nbtn));
>
> }//the end of onClick block
>
> The code works fine.But I think this is very heavy to android
> developer so I have to change every activity . Is there anyone know
> the quicky way to change language setting?Please tell me the detail
> steps if you know. Thanks!
>
> TIP: My enviroment: android-sdk-windows-1.0_r2+JDK 6
--~--~---------~--~----~------------~-------~--~----~
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