Roland Roland - 1 year ago 103
Android Question

Set Locale programatically

My app supports 3 (soon 4) languages. Since several locales are quite similar I'd like to give the user the option to change locale in my application, for instance an Italian person might prefer Spanish over English.

Is there a way for the user to select among the locales that are available for the application and then change what locale is used? I don't see it as a problem to set locale for each Activity since it is a simple task to perform in a base class.

Answer Source

Hope this help(in onResume):

Locale locale = new Locale("ru");
Configuration config = getBaseContext().getResources().getConfiguration();
config.locale = locale;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download