'JAVA > Android' 카테고리의 다른 글
[안드로이드] 알람매니져(AlarmManager ) - 팬딩이벤트(PendingIntent ) 생성유무 (0) | 2014.08.18 |
---|---|
SQLite 날짜관련 함수. 그리고 TOP (0) | 2014.08.07 |
[Android] 로밍 여부 확인하기 (0) | 2014.07.29 |
[안드로이드] 비행기 모드 확인 (0) | 2014.07.28 |
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
[안드로이드] 알람매니져(AlarmManager ) - 팬딩이벤트(PendingIntent ) 생성유무 (0) | 2014.08.18 |
---|---|
SQLite 날짜관련 함수. 그리고 TOP (0) | 2014.08.07 |
[Android] 로밍 여부 확인하기 (0) | 2014.07.29 |
[안드로이드] 비행기 모드 확인 (0) | 2014.07.28 |
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
SQLite 날짜관련 함수. 그리고 TOP (0) | 2014.08.07 |
---|---|
[안드로이드] BOOT_COMPLETED 사용법 (0) | 2014.07.30 |
[안드로이드] 비행기 모드 확인 (0) | 2014.07.28 |
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
[안드로이드] API 버전 체크 (0) | 2014.07.15 |
Turning ON or OFF airplane mode programmatically in Android _ yogeshblogspot.pdf
==================================================================================
private Boolean isAirModeOn() {
Boolean bol;
if(Build.VERSION.SDK_INT<17){
bol = Settings.System.getInt(context.getContentResolver(), Settings.System.AIRPLANE_MODE_ON, 0) == 1;
}else{
bol = Settings.System.getInt(context.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) == 1;
}
return bol;
}
==================================================================================
[안드로이드] BOOT_COMPLETED 사용법 (0) | 2014.07.30 |
---|---|
[Android] 로밍 여부 확인하기 (0) | 2014.07.29 |
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
[안드로이드] API 버전 체크 (0) | 2014.07.15 |
[Android] NoSuchMethodError - removeOnGlobalLayoutListener (317) | 2014.07.15 |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.new_game:
newGame();
return true;
case R.id.help:
showHelp();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
[Android] 로밍 여부 확인하기 (0) | 2014.07.29 |
---|---|
[안드로이드] 비행기 모드 확인 (0) | 2014.07.28 |
[안드로이드] API 버전 체크 (0) | 2014.07.15 |
[Android] NoSuchMethodError - removeOnGlobalLayoutListener (317) | 2014.07.15 |
[Android] 텍스트뷰 폰트 사이즈 조절. (0) | 2014.07.10 |
버전가져오기
You can get it by calling Build.VERSION.SDK
.
From 1.6 on, you should use Build.VERSION.SDK_INT
instead
because Build.VERSION.SDK
is deprecated.
http://stackoverflow.com/questions/3506792/android-api-version-programmatically
매칭 시키기
Code Name Version Api level
(no code name) 1.0 API level 1
(no code name) 1.1 API level 2
Cupcake 1.5 API level 3, NDK 1
Donut 1.6 API level 4, NDK 2
Eclair 2.0 API level 5
Eclair 2.0.1 API level 6
Eclair 2.1 API level 7, NDK 3
Froyo 2.2.x API level 8, NDK 4
Gingerbread 2.3 - 2.3.2 API level 9, NDK 5
Gingerbread 2.3.3 - 2.3.7 API level 10
Honeycomb 3.0 API level 11
Honeycomb 3.1 API level 12, NDK 6
Honeycomb 3.2.x API level 13
Ice Cream Sandwich 4.0.1 - 4.0.2 API level 14, NDK 7
Ice Cream Sandwich 4.0.3 - 4.0.4 API level 15, NDK 8
Jelly Bean 4.1.x API level 16
Jelly Bean 4.2.x API level 17
Jelly Bean 4.3.x API level 18
KitKat 4.4 - 4.4.2 API level 19
[안드로이드] 비행기 모드 확인 (0) | 2014.07.28 |
---|---|
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
[Android] NoSuchMethodError - removeOnGlobalLayoutListener (317) | 2014.07.15 |
[Android] 텍스트뷰 폰트 사이즈 조절. (0) | 2014.07.10 |
[안드로이드] 같은 균등 Width 분할 (0) | 2014.07.02 |
07-15 15:19:04.680: E/AndroidRuntime(9733): java.lang.NoSuchMethodError: android.view.ViewTreeObserver.removeOnGlobalLayoutListener
There are two methods in ViewTreeObserver
with almost the same name.
removeOnGlobalLayoutListener(ViewTreeObserver.OnGlobalLayoutListener victim)
(on then global) is a method that was added in API 16. It replaces
removeGlobalOnLayoutListener(ViewTreeObserver.OnGlobalLayoutListener victim)
(global then on) which has existed since API 1, but which is now deprecated. Compatibility libraries can cause confusion about these two methods; it can appear present at compile-time but fail subsequently.
This code thwarts the error:
try {
thing.removeOnGlobalLayoutListener(victim);
} catch (NoSuchMethodError x) {
thing.removeGlobalOnLayoutListener(victim);
}
So does this code:
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
thing.removeGlobalOnLayoutListener(victim);
} else {
thing.removeOnGlobalLayoutListener(victim);
}
android - Why does removeOnGlobalLayoutListener throw a NoSuchMethodError_ - Stack Overflow.pdf
[안드로이드] 메뉴 추가 (0) | 2014.07.21 |
---|---|
[안드로이드] API 버전 체크 (0) | 2014.07.15 |
[Android] 텍스트뷰 폰트 사이즈 조절. (0) | 2014.07.10 |
[안드로이드] 같은 균등 Width 분할 (0) | 2014.07.02 |
[안드로이드] fragment 에서 findViewById (0) | 2014.07.02 |
STextView("Hello").textSize(20 sp) // not correct!
The unit specification like 20 sp
is very common in Scaloid. The implicit function sp
converts the number from the sp unit to the pixel unit. The code above looks fine because the most of the Android API receives a size as the pixel unit. But there was a single exception. The methodTextView.setTextSize(float)
does not receives a size as the pixel unit, it receives sp unit instead. It may cause a mistake because the most of other APIs handles a size as the pixel unit, even inTextView.getTextSize()
!!! So I overridden STextView.textSize
so that the APIs have consistency in pixel units:@inline def textSize (p: Int) = textSize_=(p)
@inline def textSize_=(p: Int) = {
basis.setTextSize(android.util.TypedValue.COMPLEX_UNIT_PX, p)
basis
}
Now we can safely use the method textSize
with the implicit unit conversions:STextView("Hello").textSize(20 sp) // correct :-D
I patched the current snapshot, and it will be available at the next release of Scaloid.[안드로이드] API 버전 체크 (0) | 2014.07.15 |
---|---|
[Android] NoSuchMethodError - removeOnGlobalLayoutListener (317) | 2014.07.15 |
[안드로이드] 같은 균등 Width 분할 (0) | 2014.07.02 |
[안드로이드] fragment 에서 findViewById (0) | 2014.07.02 |
[안드로이드] 아이디 문자열로 int 아이디값 구하기. (0) | 2014.07.01 |
android - Set two buttons to same width regardless of screen size_ - Stack Overflow.pdf
weight 속성은, 남은 width에서 가져온다.
그래서 뷰의 width=0으로 고정해줘야만, 길이가 균등분배된다.
아니면 해당 뷰들의 width가 동일해도 좋다.
[Android] NoSuchMethodError - removeOnGlobalLayoutListener (317) | 2014.07.15 |
---|---|
[Android] 텍스트뷰 폰트 사이즈 조절. (0) | 2014.07.10 |
[안드로이드] fragment 에서 findViewById (0) | 2014.07.02 |
[안드로이드] 아이디 문자열로 int 아이디값 구하기. (0) | 2014.07.01 |
[안드로이드] 뷰페이져 view swipe (support library) (0) | 2014.07.01 |
[Android] 텍스트뷰 폰트 사이즈 조절. (0) | 2014.07.10 |
---|---|
[안드로이드] 같은 균등 Width 분할 (0) | 2014.07.02 |
[안드로이드] 아이디 문자열로 int 아이디값 구하기. (0) | 2014.07.01 |
[안드로이드] 뷰페이져 view swipe (support library) (0) | 2014.07.01 |
[Android] 액션바 관련 (2) | 2014.01.06 |
Context -> getResources();
int resID = getResources().getIdentifier("button_%i",
"id", getPackageName());
View addButton = findViewById(resID);
[안드로이드] 같은 균등 Width 분할 (0) | 2014.07.02 |
---|---|
[안드로이드] fragment 에서 findViewById (0) | 2014.07.02 |
[안드로이드] 뷰페이져 view swipe (support library) (0) | 2014.07.01 |
[Android] 액션바 관련 (2) | 2014.01.06 |
브로드캐스트리시버와 관련된 액션 인텐트 (0) | 2013.09.28 |