[assert] 사용법

Android/Tips 2014. 10. 28. 10:58 |


assert를 켤 때,


adb shell setprop debug.assert 1(true)



assert를 끌 때,


adb shell setprop debug.assert 0(false)





소스상에서 두개의 값이 일치하는지 확인하고 싶을 때,

(두 개의 값이 틀리면 다음 진행에 문제가 발생할 시,)


소스에 다음 한줄을 추가하면, 해당부분에서 두 값이 다르다면 exception을 발생 시킨다.

assert A(조건) == B(조건);


ex)

assert holderVMedia.getCount() == arrayListBottomBarItems.size();

Posted by 소망아기
: