I have an application with lots of activities. Many of these activities can start others, so the user's expected to generate a quite large activity stack.
I'm currently using the default activity launch behaviours. Does anybody know, if a large activity stack (like > 100) would be pose a problem? Is there a limit to this? Would it decrease performance, cause an ANR dialog, or something like that?
Thanks
Android will kill Activities when it needs to to free up memory or other resources. Per the Activity Lifecycle, and Activity is eligible to be killed as soon as it is no longer visible.
Assuming you correctly handle the killing and restarting of Activities, you should be fine.
As an aside, I struggle to come up with a use case from a user's perspective where I would access > 100 activities in one app...
Mayra's reasoning is wrong for this problem. Android kills activities from the stack as long as they are activities from a different application that the one currently running.
Therefore, if your application opens 100 activities, the 100 will be kept in the stack, and most probably you'll find OutOfMemoryError's.
Try to structure your app differently.
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