일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- gradle
- himatic7sii
- 니콘
- 35mmf2.8
- COLORPLUS
- 필름카메라
- variants
- film
- fm2
- himatic
- rx
- Flavor
- Git
- It
- e마운트
- Realm
- Sony
- Minolta
- emount
- 하이매틱
- 미놀타
- Nikon
- fullframe
- Kodak
- SSL
- himatic7s2
- Exception
- 풀프레임
- Android
- portra400
Archives
- Today
- Total
BloByJames
날 미치게 하는 Exception: java.util.IllegalFormatConversionException: %d can't format java.lang.String arguments 본문
프로그래밍/안드로이드
날 미치게 하는 Exception: java.util.IllegalFormatConversionException: %d can't format java.lang.String arguments
blobyjames 2016. 12. 2. 22:28파편화가 심한 Android에서는 예상치 못한 오류가 참 많습니다.
다양한 제조사와 셀 수 없이 많은 기종들...
특정 OS와 특정 단말기에서
DatePicker를 사용하면 발생하게 되는 Exception 입니다.
java.util.IllegalFormatConversionException:
%d can't format java.lang.String arguments
이 골치아픈 error는 어떠한 조건에서 발생하는 것도 아닌,
특정 version의 OS를 장착 한 특정 단말기에서 재현됨을 말씀드립니다.
특정 version
- 5.0.1
특정 단말기
Samsung
- Galaxy S4
- Galaxy S5
- Galaxy Note 3
해결책은 아래와 같습니다.
Context context = getActivity();
if (isBrokenSamsungDevice()) {
context = new ContextThemeWrapper(getActivity(), android.R.style.Theme_Holo_Light_Dialog);
}
DatePickerDialog datePickerDialog = new DatePickerDialog(context, this, year, month, day);
if (isBrokenSamsungDevice()) {
datePickerDialog.setTitle("");
datePickerDialog.updateDate(year, month, day);
}
private static boolean isBrokenSamsungDevice() {
return (Build.MANUFACTURER.equalsIgnoreCase("samsung")
&& isBetweenAndroidVersions(
Build.VERSION_CODES.LOLLIPOP,
Build.VERSION_CODES.LOLLIPOP_MR1));
}
private static boolean isBetweenAndroidVersions(int min, int max) {
return Build.VERSION.SDK_INT >= min && Build.VERSION.SDK_INT <= max;
}
해결은 간단하지만
삼성 너무합니다.
'프로그래밍 > 안드로이드' 카테고리의 다른 글
Travis CI with Android (1) - Setup (0) | 2019.07.20 |
---|---|
Glide와 함께 Circular Notification Icon 만들기 (0) | 2017.03.13 |
날 미치게 하는 Exception: io.realm.exceptions.RealmError: Unrecoverable error. (0) | 2016.11.08 |
Gradle Flavor 그리고 google-services.json (0) | 2016.10.21 |
Gradle Flavor 그리고 apk build (0) | 2016.10.08 |
Comments