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. sendBroadcast() is crashing

Hi All,

I am try to post message with the help of sendBroadcast() API. But its
carshing.
Please find the piece of code as below:

                  public static final String UICbkdAction = new String
("android.intent.action.UICbk");
                  protected IntentFilter CallbackFilter = new
IntentFilter(UICbkdAction);

               CallbackReceiver=new IntentReceiver();
                registerReceiver(CallbackReceiver, CallbackFilter);

                Intent scan = new Intent(UICbkdAction);
                Bundle b=new Bundle();
                b.putInt("CbkType", ServerAdded);
                b.putString("resp", text);
                //b.putBoolean("result", ret_val);
                scan.putExtras(b);

                sendBroadcast(scan);  ------------->crashing with NULL
pointer exception

         class MyIntentReceiver extends BroadcastReceiver
        {
                @Override
                public void onReceive(Context context, Intent intent)
                {
                            //doing something
                }
         }

Please help me..

Thanks in advance,
Yogi
--~--~---------~--~----~------------~-------~--~----~

2. Screen composition

Hey there,

Does anyone know where the screen composition is being done in code
right now? Say if I'm running the video or camera use case, does it
take a 32 bit UI assets or 24 bit with a separate global alpha and
blend it with the video/viewfinder? Thanks.
--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Need asound.conf (or a stub of it with some "comments")

4. Need asound.conf (or a stub of it with some "comments"

5. about epc android driver

6. SDK 1.5 on VISTA - start emulator with no success

7. Byte code format