Added an interesting tid-bit (#29214)
This is asked in a bunch of interviews and as trick question in quizzes too.
This commit is contained in:
committed by
Christopher McCormack
parent
eb150cedbc
commit
0848c89ee4
@ -51,6 +51,7 @@ An activity facilitates the following key interactions between system and app:
|
||||
|
||||
> The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method.
|
||||
This call is often used when the user hits the back button, or closes the instance of the app.
|
||||
Interestingly, when app display changes orientation (e.g., from landscape to portrait or the other way around), `onDestroy()` and `onCreate()` are called. This means that the Activity is recreated. This comes in handy in applications with different defined rules for landscape and portrait modes, or with different views defined for tablets and phones in these modes.
|
||||
|
||||
#### Sample code to understand Activity Lifecycle
|
||||
|
||||
|
Reference in New Issue
Block a user