How to get the device locale after changing the application locale

后端 未结 4 1054
滥情空心
滥情空心 2021-01-02 08:36

I am changing the application locale based on user choice. Independent of device locale.

using

public void setDefaultLocale(Context context, String          


        
4条回答
  •  时光说笑
    2021-01-02 09:08

    I asked something similar and found this answer, sorry if it is late:

    To find the system locale use:

    defaultLocale = Resources.getSystem().getConfiguration().locale;
    

    It gets the system locale, no matter which default locale is set for the app/activity.

提交回复
热议问题