0

On Android, why are the following calls to get the locale different?

Locale.getDefault()

and

getResources().getConfiguration().locale
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
roger778
  • 13
  • 1
  • `Locale.getDefault()` is the standard way of getting the current locale in Java, and the `getResources().getConfiguration().locale` is the Android one but it is deprecated since API 24 Checkout [this answer](https://stackoverflow.com/questions/10657747/why-does-android-have-its-own-way-to-get-the-current-locale/10671512#10671512) – Atef Aug 04 '17 at 12:28

1 Answers1

0

The locale selected on the device when the app was launched is the default locale returned by:

Locale.getDefault()

The locale currently selected on the device is the current locale (can be different from the default locale if the user changed the setting after the app launch) returned by:

getResources().getConfiguration().locale
codaddict
  • 445,704
  • 82
  • 492
  • 529