0

In android, I can get Locale instance either by:

Locale locale = getContext().getResources().getConfiguration().locale;

Or by:

Locale.getDefault().toString();

Anyone can make a concrete explanation about the differences between these two ?

Is it so that one is for app level locale while the other is system locale ?

Another question: is there a way to change device level locale programmatically? (Not app level locale)

Thanks in advance.

Mellon
  • 37,586
  • 78
  • 186
  • 264

1 Answers1

0

From the android documentation for Locale:

You can use getDefault() to get an appropriate locale for the user of the device you're running on

Andr from the android documentation for Configuration

locale: Current user preference for the locale

So yes, the .getConfiguration() locale is an app-based user preference, whereas the getDefault() locale is a (still user specific) device level selection.

Ed_
  • 18,798
  • 8
  • 45
  • 71
  • Thanks, by the way, I know how to change app level locale, but is there a way to change device level locale programmatically? – Mellon Oct 24 '13 at 11:21
  • Not that I know of... **edit** similar question [here](http://stackoverflow.com/questions/2596352/change-language-settings-locale-for-the-device) – Ed_ Oct 24 '13 at 12:01