Android get device locale

后端 未结 7 2427
滥情空心
滥情空心 2020-11-30 00:32

Upon installation of my Android program I check for device locale:

String deviceLocale=Locale.getDefault().getLanguage();

If deviceLocale i

7条回答
  •  执念已碎
    2020-11-30 00:54

    The best way to design the app is to use a default lang, English in your case, under values/ and you can add addition langs under values-XX/. In this way when a language is not supported Android fallback to your default, so English. Let the OS does the work for you :) However, yes if you change the locale you'll get your last settings, so you have to save that information somewhere.

提交回复
热议问题