2

I'm launching an activity (ActivityA) using the technique described here with FLAG_ACTIVITY_CLEAR_TOP|FLAG_ACTIVITY_SINGLE_TOP. This works if all of the activities on the back stack are still in memory. ActivityA is shown and if I tap back, the app exits.

If I use SetAlwaysFinish to make paused activities be immediately finished and repeat my test, then when I tap back in ActivityA, I'm taken to the previous activity. This shouldn't happen.

Am I testing realistic conditions when I use SetAlwaysFinish? If so, how do I configure and launch ActivityA so that the back stack is really cleared and my test works under both conditions.

Community
  • 1
  • 1
Edward Dale
  • 29,597
  • 13
  • 90
  • 129

1 Answers1

0

Using "set always finish activities" does not simulate any realistic condition. It is supposed to be used as a debugging help, but since Android doesn't actually finish activities when it needs to recover resources (it actually kills the host process instead), it is little help in debugging or testing real world conditions.

David Wasser
  • 93,459
  • 16
  • 209
  • 274