Activity LifeCycle Flashcards

1
Q

what is an activity lifecycle

A

Different states an activity goes through

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

onCreate
onStart
onResume

A
When activity is lauched, its the first method getting called. Its like a constructor of a class 
When user can see the screen, onStart is called
When screen is ready to interact with the user, then its onResume

These 3 methods get called so quickly that as a end user you dont come to know

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

onPause
onStop
onDestroy

A

onPause - when part of app is visible but in background
onStop - when activity is not visible to user
onDestroy - when activity is killed

when we minimize - onPause and onStop is called

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

onRestart

A

when we go back to the activity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

usecase 1

A
when we start 2nd activity from 1st activity 
following is the sequence of calls
a1 - onPause
a2 - onCreate
a2 - onStart
a2- onResume
a1- onStop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

usecase2

A
when we move back to A1
A2 onPause
A1 onRestart
A1 onStart
A1 onResume
A2 onStop
A2 onDestroy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

usecase3

A

screenlock

onPause
onStop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

usecase4

A

when screen lock is opened

onRestart
onStart
onResume

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

usecase5

A

pressing the home button

onPause
onStop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

usecase 6

A

when resuming the activity

onRestart
onStart
onResume

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

usecase 7

A

killing app

onPause
onStop
onDestroy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

usecase 8

A

Setting Permissions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly