How to get language (locale) currently Android app displays?

后端 未结 5 2041
遥遥无期
遥遥无期 2020-12-09 02:06

How to get know language (locale) currently Android app uses to display texts to user?

I know I can use Locale.getDefault() to get default OS locale. Bu

5条回答
  •  星月不相逢
    2020-12-09 02:36

    It's on your app configuration, so you can get it with :

    getResources().getConfiguration().locale
    

    this is different from

    Locale.getDefault()
    

    and shows the Locale that the app uses which can be different.

    It can be different because the developer can change it by updating the app configuration, check : Resources.updateConfiguration

提交回复
热议问题