title: How to change language permanently on Android Studio?
body: <p>I created an Android app with Android Studio that can <strong>change language settings</strong> while executing it from the <strong>top menu button</strong>. Everything works, but whenever I close the app or I rotate the screen the language keeps getting reset to the system one. How to make <strong>changes inside the app permanent</strong>? (Note that inside <em>AndroidManifest.xml</em> I have the following line <code>android:configChanges="locale"</code> and deleting it doesn't solve the issue.)
  I'm using the following code inside my <em>MainActivity.java</em>:</p>
  
  <pre><code> public void changeLanguage (String toLoad) {
          Locale locale = new Locale(toLoad);
          Locale.setDefault(locale);
          Configuration config = new Configuration();
          config.locale= locale;
          getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
          Intent intent = new Intent(MainActivity.this, MainActivity.class);
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
          startActivity(intent);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          String languageToLoad;
          switch (item.getItemId()) {
              case R.id.english_menu:  
                  languageToLoad = "en";             
                  changeLanguage(languageToLoad);
                  return true;
              case R.id.italian_menu:              
                  languageToLoad = "it";
                  changeLanguage(languageToLoad);
                  return true;
              case R.id.french_menu:              
                  languageToLoad = "fr";
                  changeLanguage(languageToLoad);
                  return true;               
              default:
                  return super.onOptionsItemSelected(item);
          }
      }
  </code></pre>