Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Activity Lifecycle: onStart() -> onStop() possible?

Tags:

android

In the Android Application Fundamentals it says that after the call to the onStart()-method of the activity lifecycle either the callback method onResume() or onStop() is called. In case of an "normal" Start of an activity the system calls onCreate(), onStart(), onResume(). But does somebody know an example where onStart() - onStop() are executed one after another?

like image 881
Coco Avatar asked Oct 05 '10 15:10

Coco


1 Answers

  1. From your activity, start another activity that is not full-screen (for example give it android:theme="@android:style/Theme.Dialog").

    At this point your first activity has had onPause() called but not onStop() because it is not in the front but still visible.

  2. Press home.

    At this point onStop() is called for your first activity.

  3. Relaunch your app.

    At this point onStart() is called for your first activity, but not onResume() because it still has the non-full-screen activity on top of it.

  4. Press home.

    At this point onStop() is called on the first activity, without having gone through onResume().

like image 136
hackbod Avatar answered Oct 25 '22 05:10

hackbod