Android - Language Lấy ngôn ngữ, địa điểm hiện tại của thiết bị

Sử dụng Locale:
String locale = getResources().getConfiguration().locale.getCountry();
hoặc:
String localeDis = getResources().getConfiguration().locale.getDisplayCountry();
hoặc:
String displayLanguage=Locale.getDefault().getDisplayLanguage();

Sử dụng thông tin cung cấp từ SIM:


TelephonyManager teleMgr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
if (teleMgr != null) {
 String countryISOCode = teleMgr.getSimCountryIso();
}

Nhận xét

Bài đăng phổ biến từ blog này

Android - Date Time - Lấy giá trị ngày, giờ theo định dạng tùy biến trong Android Studio

Android - Custom SearchView - Tạo khung tìm kiếm đơn giản trong Android Studio

Android - Image - Take Photo, Choose Photo from Gallery - Xử lý chụp ảnh, lấy ảnh trong Android Studio