> If you still insist on using a single activity

I don't insist on anything :-) I just want to talk about it.

> And speaking of state, I don't think you want to be using
> setContentView() to change views, even within a single application.
> Changing content views for your application will mean the built-in
> state management will fail.  Consider if the users receives a phone
> call, switches task via notification, or hits the home button.  If
> your activity is closed due to memory constraints, its last saved
> state may not match the view when your application restarts.  Your
> application will appear broken to a user, loosing state if they
> multitask.

It is sure that if I use setContentView(view), I have according
boolean variables that tell which view is active at the moment. All
other view variables are set to inactive/ false then.
If I store these variables during onPause(), everything gets restored
like it should, when the Activity is about to restart again. Of course
the last state has to be saved properly, but that's the same if you
take lots of single Activities, just more variables maybe.

I have successfully done this approach for Applets. The intent/
multiple-activity pattern is just unfamiliar to me.

>> I agree, but as I have understood, freeing up memory would mean that
>> the particular acivity is entirely shut down. The system would do that
>> only if it is absolutely necessary. I doubt if the rest of the
>> application continues working fine in that case.

>If the appropriate state is saved during onPause(), why wouldn't the
>rest of the application work when an activity is shut down.

I have meant it other way. (As far as I have understood the concept,)
freeing up memory would mean, that the Activity is entirely destroyed
and onDestroy() gets passed.
I suppose, that this happens only if the system is really overexerted
(or if the activity isn't used for long time). If the G1 (as it is a
strong device compared to others) really gets out of memory, I don't
think that it makes a large difference if you destroy a part of your
Application you don't use anymore. Maybe for some special cases it
does.
Going out of memory would mean, A.) that the resources of your
actually running Activity are too heavy-weight or B.) you have dozens
of passive Activities which aren't destroyed. For the first case, it
would make more sense to try making the actual Activity more efficient
(and freeing up memory manually).
For the second case, I think, there would be a remarkable performance
loss BEFORE the tons of non-used Activities are finally being
destroyed. Therefore maybe it is even better to quit the whole
application and taking steps to destroy the non-used Activities.

That's only my theory I know :-)  Hope I get some comments for it.

Robert

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to