Mehdi Charife
Mehdi Charife

Reputation: 1018

Activity Life Cycle: How can a new activtiy come to the foreground before being created?

While reading a couple of answers in this post, the following passage from this answer had me in a state of confusion:

onPause(): Called as part of the activity lifecycle when an activity is going into the background, but has not (yet) been killed. The counterpart to onResume(). When activity B is launched in front of activity A, this callback will be invoked on A. B will not be created until A's onPause() returns, so be sure to not do anything lengthy here.

The above seems to suggest the following ordering of events:

  1. B is launched in front of A;
  2. onPause() is called on A;
  3. onPause() returns;
  4. B is created.

What I don't understand pertains to how can the first event precede the fourth, i.e., how can B be launched and appear in front of A before being created in the first place.

Upvotes: 0

Views: 52

Answers (0)

Related Questions