We know that the android activity cycle has multiple phases.
between onStart()
and onStop()
is called the visible lifetime
between onResume()
and onPause()
is called the foreground lifetime
What are the the key difference between them? Please give examples if possible.
If I display an Activity on the screen and the user is interacting with it, it is both in the foreground and visible.
If I start another Activity, which is transparent and shows a dialog box over the previous Activity, then the new Activity (the dialog box) is in the foreground and the old Activity is not in the foreground but still visible.
between onStart()
and onStop()
called visible lifetime that mean that the activity is visible either entire activity or partially visible and the user can see it on the screen and interacte with
between onResume()
and onPause()
called foreground lifetime that your activity is full visible and running and have full focus .
UPDATE
partially visible for example if another activity come in front of the current one and it only display a dialog and a transparent background . the user can see that activity but cant interact with it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With