title: How to get system's Locale (not application's) in android
body: <p>I am writing an app that has an option menu, with three options for language : automatic, english , greek.</p>
  
  <p>When the user changes the setting, I save it in shared preferences, and call my starting activity with the new task flag</p>
  
  <p>when that activity starts (before even setContentView) I call the following method:</p>
  
  <pre><code>        string language = MainApplication.Language; //this is from shared preferences
          if (language == null || language.Equals("auto")) {
              language = Java.Util.Locale.Default.Language; //if language is not set, or the setting is auto then load the default language
              MainApplication.Language = "auto"; //save into the shared preferences that the language was set to auto
          }
          App.instance.set_language(language); //update the data layer's language
          Java.Util.Locale locale = new Java.Util.Locale(language); 
          Java.Util.Locale.Default = locale; //change the default locale
          Configuration config = new Configuration();//create a new configuration and set its locale
          config.Locale = locale;
          Application.Context.Resources.UpdateConfiguration(config, null);//update the system locale
  </code></pre>
  
  <p>The above is written in Xamarin, so it's C# but it's the same code for java</p>
  
  <p>My problem is that if I change the language to greek for example, when the code above runs it sets the default locale to "el" , but if the user selects the automatic option after that , because the default locale for the application is "el" it preserves that setting, even though my system language is english.</p>
  
  <p>when I restart the application it works correctly because the application's default locale is that of the system</p>
  
  <p>so my question is, is there a way to get the system's locale and not the applications?</p>
  
  <p>p.s. I know that I can always store the system's locale in Application and change it in OnConfigurationChanged ,I was just wandering if there is another way</p>