what is the correct way to force existing activities to reload using the new local

Posted by pengwang on Stack Overflow See other posts from Stack Overflow or by pengwang
Published on 2011-01-10T10:49:25Z Indexed on 2011/01/10 10:53 UTC
Read the original article Hit count: 203

Filed under:

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?

© Stack Overflow or respective owner

Related posts about android