title: Change language for whole Android application activities from Setting activity
body: <p>I'm trying to build a very simple application to test the multi language subject, the application should also recognize the language of the device , but also there is a way to change the language from another activity.</p>
  
  <p>I'm using the languages folders, so if the user language is suite to one of the supported languages, it will take the right one.</p>
  
  <p>The problem start when I'm trying to change it from 'Setting' activity.</p>
  
  <p>I have a spinner that include the supported languages, after selecting new language, the current activity should be close and the language of both activities should be changed.</p>
  
  <p>I saw a couple of examples on web' but no one help me here.</p>
  
  <p>This is my XML code (just include a sippner and text):</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:gravity="center"
      android:orientation="vertical"
      tools:context="com.MES.yo.ActLanguageSettings"&gt;
  
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textSize="25sp"
          android:text="@string/Choose_Language" /&gt;
  
      &lt;ImageView
          android:id="@+id/imageView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/change_language" /&gt;
  
      &lt;Spinner
          android:id="@+id/spnlanguage"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>This is the code for changing the language:</p>
  
  <pre><code>public void changeLang(String lang)
      {
          if (lang.equalsIgnoreCase(""))
           return;
          myLocale = new Locale(lang);
          saveLocale(lang);
          Locale.setDefault(myLocale);
          android.content.res.Configuration config = new android.content.res.Configuration();
          config.locale = myLocale;
          getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
      }
  
      private void saveLocale(String lang)
      {
          String langPref = "Language";
          SharedPreferences prefs = getSharedPreferences("CommonPrefs", Activity.MODE_PRIVATE);
          SharedPreferences.Editor editor = prefs.edit();
          editor.putString(langPref, lang);
          editor.commit();
      }
  </code></pre>
  
  <p>And for each activity I'm calling to "onConfigurationChanged" method like this:</p>
  
  <pre><code>@Override
  public void onConfigurationChanged(Configuration newConfig) {
      // TODO Auto-generated method stub
      Locale locale = new Locale(GVC.getLanguage());
      newConfig.locale = locale;
      super.onConfigurationChanged(newConfig);
      Locale.setDefault(locale);
      getBaseContext().getResources().updateConfiguration(newConfig,getBaseContext().getResources().getDisplayMetrics());
  }
  </code></pre>
  
  <p>The Manifest file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.MES.yo"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="9"
          android:targetSdkVersion="18" /&gt;
  
      &lt;application
          android:name=".GlobalVarClass"
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name" 
              android:configChanges="locale"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".ActLanguageSettings"
              android:label="@string/title_activity_act_language_settings" 
              android:configChanges="locale"&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value="com.MES.MySperm.MainActivity" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>This is doesn't work at all for me.</p>
  
  <p>I tried also to change the language like this:</p>
  
  <pre><code>public void setLocale(String lang) {
              GVC.setLanguage(lang);
              myLocale = new Locale(lang);
              Resources res = getResources();
              DisplayMetrics dm = res.getDisplayMetrics();
              Configuration conf = res.getConfiguration();
              conf.locale = myLocale;
              res.updateConfiguration(conf, dm);
              Intent refresh = new Intent(this, ActLanguageSettings.class);
              startActivity(refresh);
              finish();
      }
  </code></pre>
  
  <p>here the language was changed, but not for all other activities, Is there a rule of thumb for how to do it right?</p>