what is the correct way to force existing activities to reload using the new local
- by pengwang
have a settings dialog/activity where I allow the user to change the locale. Within that activity i call
Resources res = ctx.getResources();
// Change locale settings on the device
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.locale = new Locale(language_code.toLowerCase(),
coutry_code.toUpperCase());
res.updateConfiguration(conf, dm);
and call onChanged() for my settings ListView... everything changes
perfectly. Very nice.
Then I hit the back button to go back to the previous activity
thinking everything should be switched; nope. Everything is still in
the previous locale. So I added the above code in the onResume() of
the activity thinking that would do it; nope. Also, when I click the
menu button of this activity again (not first time) I do not get
called in onCreateOptionsMenu() it just displays the previous menu.
My question is what is the correct way to force existing activities to
reload using the new local?