Created
July 27, 2014 05:15
-
-
Save rajbharath/c05401bd9b0808988ce2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. activity is a screen displayed to the user with the user interface controls | |
2. an application will consist many activity but atleast one will be main to start with | |
3. it has following life cycle | |
oncreate -> onstart/onrestarted -> onresume -> onpause -> onstop -> ondestroy | |
for more questions explain on life cycle and back stack | |
oncreate | |
-is called when the activity is creataed | |
-here all the view initialisation can be done | |
onstart | |
- is called just about the activity is going to appear in the screen | |
on restarted | |
- is called when the activity is called after its onstop/ondestory to restore it previous state. this can be achiveied by onSavedInstancesate() and its bundle of state | |
onresume | |
- when user navigates back to the application from on pause state | |
onpause | |
- when user navigates to other activity but stil in background , user is able to see the prev activity behind the new one | |
- user can store someo very important state here. when user comes back to this activity we can show the prev status using that stored state. | |
- should not save all the variables , bcoz this will make late appearance of the upcoming activity which gives bad user experience | |
onstop | |
- this is called when the acitivyt is fully hidden | |
- here user can release the memory intensive objects | |
- when user presses back/home from an activity that is going to onstop | |
ondestroy | |
- when android needs memroy for more priority apps , it will destory the activities which are in onstop state | |
- finnish() / onfinish() these are the methods aclled by os itself to destroy an actiivyt | |
- we should not call manually these methods unless we want user should not visit this same instance of acitivyt again | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment