Reputation: 4340
In application supporting multiple languages using Locale.setDefault(newLocale);
we are changing the language but there is no way to change language to device default language. What is the best way to find device default language in settings programatically.
Upvotes: 3
Views: 4949
Reputation: 45576
In general, store user modifiable setting in a variable controlled by you, not Oracle. I.e. never call Locale.setDefault
when user changes your application's locale, but rather change a variable under your control.
There are overrides for each locale-dependent method that take Locale
parameter.
That's where you should pass locale variable under your control.
This way, you can always consult Locale.getDefault
for system settings.
Upvotes: 2
Reputation: 27211
check this:
Resources.getSystem().getConfiguration().locale.getLanguage();
Upvotes: 5