title: How to change language of full android application based on users choice from a listview?
body: <p>I am creating an android application. i want to have a screen that asks the user to select their preferred language. Here is my code for my listview. </p>
  
  <pre><code>public class LanguageSelect extends Activity {                          
  int[] IMAGES = {R.drawable.english, R.drawable.french, R.drawable.spanish, R.drawable.german, R.drawable.swedish, R.drawable.russia};
  
  String[] NAMES = {"English", "Français", "Español", "Deutsche", "svenska", "русский"};
  
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.activity_language_select);
  
      ListView listView = (ListView)findViewById(R.id.Lang);
  
      CustomAdpater customadapter = new CustomAdpater();
  
      listView.setAdapter(customadapter);
  
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
              if(i==0)
              {
                  LangHelper.changeLocale(this.getResources(), "fr");
              }
          }
      });
  }
  
  class CustomAdpater extends BaseAdapter{
      @Override
      public int getCount() {
          return IMAGES.length;
      }
  
      @Override
      public Object getItem(int i) {
          return null;
      }
  
      @Override
      public long getItemId(int i) {
          return 0;
      }
  
      @Override
      public View getView(int i, View view, ViewGroup viewGroup)
      {
          view = getLayoutInflater().inflate(R.layout.custom_layout_lang,null);
  
          ImageView imageView=(ImageView)view.findViewById(R.id.imageView);
          TextView textViewLang=(TextView)view.findViewById(R.id.textViewLang);
  
          imageView.setImageResource(IMAGES[i]);
          textViewLang.setText(NAMES[i]);
  
          return view;
      }
  }}
  </code></pre>
  
  <p>I also have created several string.xml files for the languages i wish to use from a tutorial i found. see image below</p>
  
  <p><a href="https://i.stack.imgur.com/zXjFQ.png" rel="nofollow noreferrer">strings.xml image</a></p>
  
  <p>I also created a LangHelper class. see below</p>
  
  <pre><code>public class LangHelper {
  
  public static void changeLocale(Resources res, String locale)
  {
      Configuration config;
      config = new Configuration(res.getConfiguration());
  
      switch (locale) {
          case "es":
              config.locale = new Locale("es");
              break;
          case "fr":
              config.locale = new Locale("fr");
              break;
          default:
              config.locale = new Locale("en");
      }
      res.updateConfiguration(config, res.getDisplayMetrics());
  }}
  </code></pre>
  
  <p>My issue now is connecting the LangHelper class to the Listview, so that when the user selects their desired language from the list the following pages i.e. the full application is now translated into that language that the user has selected</p>