Different states of Android Activity
An Android Activity has 4 States
- Running
- Paused
- Stopped
- Destroyed
Now there is a very unclear Demarcation among them if you just started learning Android application development. I will try to explain it in simple terms. So hang on!
1) Running
When a user is actively interacting with an Activity then the activity is in Running State.
2) Paused
When a partial or a transparent Dialog/Activity gets focus on the top of the previous Activity then the Activity goes to the paused state.
You can see that the dialog partially hides the “Profile Activity”. The profile Activity is still visible but the user can not interact with it because the dialog has gained the focus. In this case, the Profile Activity goes to the paused state.
3) Stopped
When an activity gets completely hidden by another Activity or dialog then the Activity goes to stop state.
You can see the profile Activity gets completely hidden by Another Activity.
4) Destroyed
There are two main reasons when an activity goes to the destroyed state.
- Android OS
- YOU
Android OS: When an activity remains in background for way too long. Then there is a possibility that the Android OS may destroy your Activity to free up some space for more important tasks.
You: When you call finish() method in the Activity then the activity goes to the destroyed state.
I know I have not covered the lifecycle methods and Activity Backstack while explaining the states. But the idea was to keep this article as simple as possible. Hope you all liked it.
Putting up content takes a lot of time and effort 😓.
👏 clap 👏 If you think you learned something from this article.You can find me on Stackoverflow,Github,and,on Linkedin.
Give feedback and feel free to correct mistakes.
Read More:
Create Multiple ViewHolders in a single RecyclerView