Hi Yuku, Please read my post here: http://groups.google.com/group/android-developers/browse_thread/thread/5440163027722168/a0b2f1003843bd5b?hl=en
BR, Adrian Vintu http://adrianvintu.com On Tue, Sep 14, 2010 at 8:11 PM, yuku <[email protected]> wrote: > Just noticed that this topic disappeared from the "Discussion" section > of the group page. > I found this using google web search engine. > > I wonder why? > > On Sep 14, 1:29 pm, yuku <[email protected]> wrote: > > I want to have a configurable language settings in my app. > > > > So, in onCreate of my activity, I call Resources.updateConfiguration > > with the new locale. > > > > However, after onCreate (at some time, I can't find it when), the > > locale is set back to the default locale. > > > > On the code example below, the strings shown in the main layout (as > > inflated by setContentView) shows the > > "in" language version, BUT when I press the menu button, on which > > onCreateMenu is called, the strings is > > taken from the "en" (default) locale. > > > > The log shows this: > > 18337 oncreate D { scale=1.0 imsi=525/1 loc=in > > touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=143} > > 30430 ActivityManager I Displayed activity > > yuku.coba.locale/.CobaLocaleActivity: 266 ms (total 266 ms) > > 18337 KeyCharacterMap W No keyboard for id 65540 > > 18337 KeyCharacterMap W Using default keymap: /system/usr/ > > keychars/qwerty.kcm.bin > > 18337 onmenu D { scale=1.0 imsi=525/1 loc=en_GB > > touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=143} > > > > Between "oncreate" and "onmenu", the locale magically changes. > > > > Please help, I have been tinkering with this with no luck. > > > > Thanks, > > Yuku > > > > @Override > > public void onCreate(Bundle savedInstanceState) { > > super.onCreate(savedInstanceState); > > > > Configuration c = new Configuration(); > > c.locale = new Locale("in"); > > getResources().updateConfiguration(c, null); > > > > setContentView(R.layout.main); > > Log.d("oncreate", getResources().getConfiguration().toString()); > > } > > > > @Override > > public boolean onCreateOptionsMenu(Menu menu) { > > Log.d("onmenu", getResources().getConfiguration().toString()); > > new MenuInflater(this).inflate(R.menu.utama, menu); > > > > return true; > > } > > -- > 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]<android-developers%[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 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

