title: How to programmatically change language?
body: <p>I want to programmatically change the language.</p>
  
  <p>So I have built two xml files.</p>
  
  <pre><code>values-it
  --&gt;string.xml
  
  values-en
  --&gt;string.xml
  </code></pre>
  
  <p>This is the code in MainActivity to change the language of the whole application:</p>
  
  <p>//ITALIAN</p>
  
  <pre><code>Resources res = getApplicationContext().getResources();
  DisplayMetrics dm = res.getDisplayMetrics();
  android.content.res.Configuration conf = res.getConfiguration();
  conf.locale = new Locale("it");
  res.updateConfiguration(conf, dm);
  </code></pre>
  
  <p>//ENGLISH</p>
  
  <pre><code>Resources res2 = getApplicationContext().getResources();
  DisplayMetrics dm2 = res2.getDisplayMetrics();
  android.content.res.Configuration conf2 = res2.getConfiguration();
  conf2.locale = new Locale("en");
  res2.updateConfiguration(conf2, dm2);
  </code></pre>
  
  <p>Now if I set the English language (for example) the code is executed with no error, but the label doesn't not change its text.<br>
  If I change the orientation of my device, the label changes its text correctly.</p>
  
  <p>Now how can I modify my code to automatically refresh the label?</p>