0

i use this following code to change language in my app

        if (Locale.getDefault().getLanguage().equals("en")){
        Locale locale = new Locale("en");
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale; 
        getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
        homeLayout.setBackgroundResource(R.drawable.accueil_en);
    }
    else {
        Locale locale = new Locale("fr");
        Locale.setDefault(locale);
        Configuration config = new Configuration();
        config.locale = locale; 
        getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
        homeLayout.setBackgroundResource(R.drawable.nouveau_home0);
    }

But when i think my language doesn't change because my keyboard always still in default language (french). How can i change language in my app and be sure that keyboard change too.

please help

  • 4 localization u can check http://stackoverflow.com/questions/21086374/changing-android-application-language/21087465#21087465 – PankajAndroid Apr 11 '14 at 07:40

1 Answers1

0

Do you have the following in your manifest file?

<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"
/>

And also you need to call setContentView after the button click. Or call onCreate(null);

Lazy Ninja
  • 22,342
  • 9
  • 83
  • 103