title: Deprecated updateConfiguration() - Android
body: <p>I defined <code>layouts</code> for multiple languages and multiple devices like below:</p>
  
  <p><a href="https://i.stack.imgur.com/Ng8jW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ng8jW.png" alt="enter image description here"></a></p>
  
  <p>I set proper <code>layout</code> with custom language like bellow :</p>
  
  <pre><code>String languageToLoad = "ar"; 
  Locale locale = new Locale(languageToLoad);
  Locale.setDefault(locale);
  Configuration config = new Configuration();
  config.setLocale(locale);
  getBaseContext().getResources().updateConfiguration(config, null);
  this.setContentView(R.layout.activity_main);
  </code></pre>
  
  <p>For language (ar - Arabic) I fetch <code>layout-ldrtl</code> or <code>layout-ldrtl-sw600dp</code> and other language (en - English) I fetch <code>layout-ldltr</code> or <code>layout-ldltr-sw600dp</code> and above code good work.</p>
  
  <p><strong>Problem :</strong> In this line <code>getBaseContext().getResources().updateConfiguration(config, null);</code> say me <code>updateConfiguration</code> is deprecated and then I use from <code>createConfigurationContext</code> but when I use from this method the source don't work true and don't get me proper layout .</p>