I am trying to understand the actual concepts of the lifecycle methods of an Activity.
I am focusing on only primary lifecycle methods as mentioned below
onCreate()
onStart()
onResume()
onPause()
onStop()
onDestroy()
Can someone please explain a scenario where we can skip a method and rest lifecycle works perfectly fine?
E.g. if I swipe up and kill the application, onPause() and onStop() methods will be skipped and only the onDestroy() method will execute.
you cannot skip those methods, because when being implemented, they must call to their super class eg. AppCompatActivity - and when not being implemented, the will nevertheless be triggered within the super class. just see the documentation: Understand the Activity Lifecycle.

Can someone please explain a scenario where we can skip a method and rest lifecycle works perfectly fine.
It never can happen unless you manually call finish(), say, in onCreate() which is quite pointless. If a lifecycle method is "skipped" by the system (and the only scenario when it happens is an app process being killed) the rest of the methods are also "skipped".
If I swipe up and kill the application, onPause() and onStop() methods will be skipped and only onDestroy() method will execute.
Again, it never can happen by the reason described above.
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