The correct way of getting the language of your device is the following:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
return context.getResources().getConfiguration().getLocales().get(0);
} else {
return context.getResources().getConfiguration().locale;
}
Hope it helps.