• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps how to change input laguage dynamically?

nivie

Newbie
Hi,

I am trying to change the input language. whenever user type something in edittext, app should take input in his defined language. I am using the following code to set the locale. but it is not changing the language of input. It is taking the default language-"en".

"
Resources res = getApplicationContext().getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.locale = new Locale(languageToLoad.toLowerCase());
res.updateConfiguration(conf, dm);
setContentView(R.layout.main); "

Please help with some code snippets.

Thanks in advance.
 
Back
Top Bottom