7

I am trying Android N multi window feature and I have found myself confused when starting a new activity. The problem is that when I start a new Activity, the onStop() callback is not being fired and when I press the back button from this new activity to return to the previous one, the previous one's onStart() callback is not being fired either.

Does anyone know what is happening?

--- Edited

It seems like that ActivityOptionsCompat.makeSceneTransitionAnimation has something to do with it.

Augusto Carmo
  • 4,386
  • 2
  • 28
  • 61

1 Answers1

8

Here is the android-lifecycle:

AndroidLifecycle

image source

If you call another app in multi window mode, your application is still "partially visible", so onPause() is being called, but onStop() not.

At restart it's the same: onResume() is being called, but onStart() isn't.

Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
UeliDeSchwert
  • 1,146
  • 10
  • 23
  • Thank you for your answer, @ManuToMatic. Actually, I am not calling another app, but starting a new activity from the same app. Cheers ^^ – Augusto Carmo Aug 08 '16 at 13:35
  • 1
    How do you start the other activity @AugustoCarmo? With an `Intent`, as usual? – UeliDeSchwert Aug 08 '16 at 13:43
  • I am using `ActivityOptionsCompat.makeSceneTransitionAnimation`. I have shared elements between these two activities. – Augusto Carmo Aug 08 '16 at 14:06
  • 1
    I don't know much about shared elements and transition animations, but I think it might have to do with this. Maybe it creates some kind of "link" between the two activities and thus prevents one from being fully stopped but pauses it instead. But I'd have to experiment with this a little bit. – UeliDeSchwert Aug 08 '16 at 14:21
  • That is what I am thinking too. I am trying to find a solution for this problem. When I disabled the transition feature, everything worked fine. – Augusto Carmo Aug 08 '16 at 14:37