title: Changing Locale within the app automatically to english
body: <p>I Integrated Locale (<code>en</code> and <code>ar</code>) on my application. Once I change the application to Arabic(<code>ar</code>) then close and open my application it showing the layout direction is showing as Arabic but the strings are loading English.</p>
  <p>Here is my code to change the language while button click,</p>
  <pre><code>public static void setLocale(final Context ctx, final String lang) {
      Log.d(TAG, &quot;##Changing Language to: &quot; + lang);
      AppSettings.getInstance(ctx).save(PrefKeys.language, lang);
      final Locale loc = new Locale(lang);
   
      Resources resources = ctx.getResources();
      Configuration configuration = resources.getConfiguration();
      DisplayMetrics displayMetrics = resources.getDisplayMetrics();
      if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN_MR1)
          configuration.setLocale(loc);
      else
          configuration.locale = loc;
  
      if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.N)
          ctx.createConfigurationContext(configuration);
       else
          resources.updateConfiguration(configuration, displayMetrics);
  }
  </code></pre>
  <p>Also on the Application class I added code to apply the language, Here is the code on Application Class</p>
  <pre><code> @Override
  public void onCreate() {
      super.onCreate();
      String lanuage = AppSettings.getInstance(getApplicationContext()).getLanguage();
      setLocale(new Locale(lanuage));
  }
  
  
  private void setLocale(Locale locale){
          Log.d(TAG,  &quot;##Changing Language to: &quot; + locale.getLanguage());
          Resources resources = getResources();
          Configuration configuration = resources.getConfiguration();
          DisplayMetrics displayMetrics = resources.getDisplayMetrics();
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.JELLY_BEAN_MR1){
              configuration.setLocale(locale);
          } else{
              configuration.locale=locale;
          }
          if (Build.VERSION.SDK_INT &gt; Build.VERSION_CODES.N){
              getApplicationContext().createConfigurationContext(configuration);
          } else {
              resources.updateConfiguration(configuration,displayMetrics);
          }
      }
  </code></pre>