greenhelix
greenhelix
greenhelix
05-15 12:28
  • All (229)
    • Algorithm (118)
      • Algorithm (17)
      • Graph (0)
      • Core (6)
      • Python (18)
      • PythonSnippet (4)
      • Java (59)
      • Kotlin (14)
    • Project (0)
    • Study (8)
      • License (5)
      • EIP (3)
    • Programming (63)
      • Android (41)
      • Flutter (1)
      • Bugs Life (21)
      • Linux (0)
    • Tech (32)
      • Tech (17)
      • Drone (4)
      • Hacking (11)
    • Life (6)
      • INGRESS (1)
      • 심시티빌드잇 (0)
250x250

티스토리

hELLO · Designed By 정상우.
greenhelix

greenhelix

Life cycle 생명 주기
Programming/Android

Life cycle 생명 주기

2021. 7. 14. 17:32

Activity Lifecycle

 

활동(activity)의 모든 인스턴스는 생명주기를 갖는다.

생명주기 동안의 활동의 상태는 총 4가지이다.

실행 재개 일시 중지 중단 존재하지 않음 = 소멸
resumed paused stopped nonexistent = destroyed
상태 메모리 있음? 사용자에게 보임? Foreground에서 실행?
nonexistent no no no
stopped yes no no
paused yes yes(partialy) no
resumed yes yes yes
존재하지 않음
Nonexistent
onCreate()  ⏬ onDestroy() ⏫
중단
Stopped
onStart()  ⏬ onStop()  ⏫
일시 중지
Paused
onResume()  ⏬ onPause()  ⏫
실행 재개
Resumed

Lifecycle Callback 

여기서 onCreate, onDestroy, ... 와 같은 함수들은 생명주기 콜백이라고 한다. 

 

onCreate(Bundle?)가 override하는 함수들

- setContentView(Int) :  위젯을 inflate하여 뷰 객체로 생성한 후, 화면에 보여준다.

- inflate된 위젯의 객체 참조를 얻는다. 

- 사용자와 상호 작용을 처리하기 위해 위젯에 리스너를 설정한다. 

- 외부의 모델 데이터를 연결한다. 

 

 

728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Programming > Android' 카테고리의 다른 글

XML options  (0) 2021.07.18
View  (0) 2021.07.14
Class  (0) 2021.07.12
    'Programming/Android' 카테고리의 다른 글
    • app: build.gradle
    • XML options
    • View
    • Class
    greenhelix
    greenhelix
    개발에 관한 것들과 개인적인 것을 담는 블로그

    티스토리툴바