Activity lifecycle
Activity Component는 3종류의 상태자 있다.
1) Acvite or Running: 사용자 화면에 나와있는 상태
2) paused: 다른 Activity가 forground일 경우이며 system에 의해 shut down될 수도 있음. (Linux 기반이므로 가능할 듯)
3) stopped

안드로이드는 위와 같은 상태의 변화에 대해 다음과 같은 method를 호출함으로써 Activity에 알려준다.
void onCreate(Bundle savedInstanceState)
void onStart()
void onRestart()
void onResume()
void onPause()
void onStop()
void onDestroy()
개발자는 상태 변경 시 위의 protected method를 override하려 사용할 수 있다.
모든 Activity 개발 시 onCreate()는 반드시 명시해야 한다.

Activity의 lifetime은 다음과 같이 3가지 경우로 나눌 수 있다.
1) entire lifetime: onCreate()에서 onDestroy()까지
2) visible lifetime: onStart()에서 onStop()까지
3) foreground lifetime: onResume()에서 onPause()까지


Service lifecycle
Service도 상태 변화를 확인할 수 있는 method를 가지고 있다.
void onCreate()
void onStart(Intent intent)
void onDestroy()


Service의 lifetime은 다음과 같이 2가지 경우로 나눌 수 있다.
1) entire lifetime: onCreate()에서 onDestroy()까지
2) active lifetime: onStart()





Posted by 피의복수
BLOG main image
일에 필요한 자료 by 피의복수

카테고리

분류 전체보기 (40)
프로그램이야기 (38)
끄적끄적 (1)
취미 (0)
서비스이야기 (1)
빅데이터 (0)

최근에 올라온 글