Hello,
You can change an app's internal locale like this:
private void changeInternalLocale() {
Locale newLocale = Locale.FRENCH;
Locale.setDefault(newLocale);
Configuration config =
getBaseContext().getResources().getConfiguration();
config.locale = newLocale;
getBaseContext().getResources().updateConfiguration(
config,
getBaseContext().getResources().getDisplayMetrics());
onConfigurationChanged(config);
// Restart the activity.
Intent intent = getIntent();
finish();
startActivity(intent);
}
This works on Android 4.1 and below, but it doesn't work on Android
4.2: The app becomes very unstable after you change the internal
locale, then change orientation. The Activity will continuously
relaunch itself in an endless loop.
It's like this bug here: http://code.google.com/p/android/issues/detail?id=53079
Does anyone know how to workaround it to make it work on Android 4.2?
Some apps are able to do it, but I don't know how they did it.
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.