For further actions, you may consider blocking this person and/or reporting abuse
Read next
⚡️ 15 Essential tools and resources for Frontend developers
Paul -
Identity Management: The Foundation for Security Implementation
Samuel Ekirigwe -
Understanding Neomorphic Design in Web Development: What It Is, How to Achieve It, and When to Use It
Muhammad Essa -
Linux Installation Fest - A detailed Guide to install Linux
Abhinav Pandey -
Top comments (6)
I feel like more info is needed here. What's tripping you up?
The official docs about Activity Lifecycle are so good already!
No, I understand it, but as the tag says #explainlikeimfive. It's all about explaining something to people who have little or no experience.
explainlikeimfive is great for non-techy guys, but for it guys nothing is better than actual manual.
(I'll try to come back later when I have some free time to write down my ideas).
An activity is a single screen in android, its like a window in a desktop app. And depends on whats happening with the app and with the user interaction, it can be in one of several states : that the life-cycle.
So, for know what do each method does the best resource is the official docs, but I will try to make a summary as short as possible:
onCreate(): This is called when the activity is initialized, you need implement this method in order to do any initialization specific to your activity.
onStart(): The activity start to be visible for the first time to the user.Once this callback finishes, the onResume() methods will be called.
onResume(): Into this state , it begins interact with the user. The activity continue in this state till something happen to take focus from the app or Activity (such as a incoming call). When this happen the onPause() method is called.
onPause(): This method is used to pause operations that should not happen when the Activity is in paused state. A call to this method indicates that the user is leaving the app.When the user returns to the app, the onResume() method will be called.
onStop(): his method is called when the Activity is no longer visible in the app.In this state, the system either calls the onRestart() to bring back interactivity with Activity. Or it calls the onDestroy() method to destroy the Activity.
OnDestroy(): This gets called before the Activity is destroyed. The system calls this method when a user terminates the Activity, or because the system is temporarily destroying the process that contains the Activity to save space. Be sure to free up any resources your Activity has created in this method, or else your app will have a memory leak.
OnRestart(): This gets called when an Activity restarts after it had been stopped.
Check the classic resources too :
I like this image over the classic one, i believe its more for a #explainlikeimfive topic.
If I were five, I would look you like this