Roland Roland - 7 months ago 72
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.


Hope this help(in onResume):

Locale locale = new Locale("ru");
Configuration config = getBaseContext().getResources().getConfiguration();
config.locale = locale;