Question:
Which function to check the localization of the phone (the language in which the OS is). So that later, depending on the localization of the phone, a certain class is used for further actions.
Answer:
public static Locale getCurrentLocale(Context context){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
return context.getResources().getConfiguration().getLocales().get(0);
} else{
//noinspection deprecation
return context.getResources().getConfiguration().locale;
}
}