Android Activity Lifecycle - CiphoBot

Latest

This is a online platform for educations, hacking, ethical hacking, python, Android, tips and tricks, software, information technology, engineering, computer networking articles

Android Activity Lifecycle


Your activity is monitors and react to these events by instantiating methods that override the activity class methods for each event:



onCreate()
            Called when your activity is first created. When calling onCreate, the android framework is passed a bundle object that contain any activity state save from when the activity ran before.


onStart()
            Once onStart completes, if your activity can become the foreground activity on the screen, control will transfer to onResume, if the activity cannot become the foreground activity for some reasons, control transfer to the onStop method.

onResume()
            Called right after onStart if your activity is the foreground activity on the screen. At this point your activity is running and the interact with the user. You are receiving, keyboard and touch input, and screen is displaying your user interface.

OnPause()
            At this point your activity will no longer have access to the screen, so you should stop doing things that consume battery and CPU cycles unnecessarily. Once you exit this method, android may kill your activity at any time without returning control to you.

onStop()
            Called when your activity is no longer visible, either because another activity is taken the foreground or because your activity is being destroy.

onDestroy()
            The last chance for your activity to do any processing before it is destroy. Normally you’d get to this point because the activity is done and the framework is called its finish method.

No comments:

Post a Comment