How does the ActivityStack behave when it contains thousands of Activities?

by Scythe » Sun, 01 May 2011 02:31:44 GMT


Sponsored Links
 In my app I have a about a dozen of different Activities. These
Activities are connected (can call each other with startActivity()) in
such a way, that the user can theoretically keep running in circles -
always jumping to the next Activity, never going back. Also, I really
need to maintain a proper Activity history: if the user presses the
back button, the app returns to the previous Activity, with the
previous content.

Question: Suppose the user's using the app for an extended amount of
time, going in circles between Activites as mentioned above, resulting
an ever-growing ActivityStack. Every Activity saves some state on
onSaveInstanceState() too.

- Is this a problem? (I'm afraid it is, I guess it's a memory leak to
have tens of thousands of Activity records on the stack, especially if
these save their state).
- Is there a way to limit the size of the default Android
ActivityStack's size? (size limit is X, we delete the oldest record if
it gets filled up)

Any suggestions / alternative solutions are welcome.

-- 



Re: How does the ActivityStack behave when it contains thousands of Activities?

by Kumar Bibek » Sun, 01 May 2011 02:36:22 GMT


 You will perhaps run into stack overflows or oom.  Android will try to kill
some of your activities though when it finds necessary



-- 


Sponsored Links


Re: How does the ActivityStack behave when it contains thousands of Activities?

by Dianne Hackborn » Sun, 01 May 2011 04:17:44 GMT


 It doesn't.  Don't do that.  Allowing the user to keep cycling through
activities is fundamentally flawed.  Having an application that has more
than a handful of activities on the stack is not correct, both for the way
the system works and the user experience it causes.







-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 



Other Threads

1. ToggleButton has broken.

I found ToggleButton image has broken on my device.
And, I initialized my device but occored same problem.

http://uploader.sakura.ne.jp/src/up8341.png

On emulator, it shows correct image.
My device is HTC Desire Android 2.1 Japanese version.

I want to know how to repair my device, or is it correct ToggleButton
Image on 2.1.
Thank you.

-- 

2. Addition of controls dynamically

Hi,

Can anyone tell me how to add controls dynamically in a layout similar
to the one in contacts edit screen where pressing on + button adds a
button and edit text and on pressing the - button, the last button and
edit text are removed.

Can anyone point me out the code.

Thank you,
Soumya

-- 

3. When Activity is closed, its fields is not release, how to resolve this issue.

4. OOT: Thank for MOMOD ID Android for UNBANNED ME from here :)

5. closed ... WTB - Samsung Spica di Semarang

6. Search Query Returns 0 rows

7. Please help to resolve CTS building error