반응형

전체 글 2602

Android 앱이 포 그라운드에서 실행 중인지 어떻게 알 수 있습니까?

Android 앱이 포 그라운드에서 실행 중인지 어떻게 알 수 있습니까? c2dm에 의해 트리거되는 내 Android 앱에서 상태 표시 줄 알림을 수행하고 있습니다. 앱이 실행중인 경우 알림을 표시하고 싶지 않습니다. 앱이 실행 중이고 포 그라운드에 있는지 어떻게 확인합니까? 같은 전역 변수 를 만들고에서 값 과 값을 private boolean mIsInForegroundMode;할당합니다 .falseonPause()trueonResume() 샘플 코드 : private boolean mIsInForegroundMode; @Override protected void onPause() { super.onPause(); mIsInForegroundMode = false; } @Override protect..

Program Tip 2020.09.25

중첩 된 루프에서 벗어나는 방법?

중첩 된 루프에서 벗어나는 방법? break문을 사용하면 내부 루프 만 중단되고 일부 플래그를 사용하여 외부 루프를 중단해야합니다. 그러나 중첩 된 루프가 많으면 코드가 좋지 않습니다. 모든 루프를 끊는 다른 방법이 있습니까? (사용하지 마십시오 goto stmt.) for(int i = 0; i < 1000; i++) { for(int j = 0; j < 1000; j++) { if(condition) { // both of the loops need to break and control will go to stmt2 } } } stmt2 사용하다: if (condition) { i = j = 1000; break; } 아니요, break. 이것은 마지막 남은 유효한 사용입니다 goto;) 그렇지 않은..

Program Tip 2020.09.25

Best way to incorporate Volley (or other library) into Android Studio project

Best way to incorporate Volley (or other library) into Android Studio project I've seen different advice on the best way to do this This question covers creating a jar. Elsewhere, I've seen advice to simply copy the volley source into your own project. This section on libraries at android.com would seem the most authoritative. However, after compiling volley, I don't have an aal library, whereas..

Program Tip 2020.09.25
반응형