Yes, this is really what I need. Though I see that periodically my
singleTask activity contsractor and onCreate are called which means
that activity instance is probably periodically destroyed though the
activity's finalize is not called. But I tested my sample app and it
runs without running out of memory.

It also seems that there is no need to handle onNewIntent, activity
"refresh" can be done from onResume.

On May 18, 2:14 pm, Streets Of Boston <[email protected]> wrote:
> What about setting your activity's launchMode to 'singleTask' (or
> 'singleTop') and implementing onNewIntent()? This would cause your
> current instance of your activity to be re-used.
>
> On May 18, 1:04 pm, ls02 <[email protected]> wrote:
>
>
>
> > nohistory does not work. The app runs out of memory.
>
> > On May 18, 12:33 pm, blcooley <[email protected]> wrote:
>
> > > Looks like an easier way to do this might be to set android:nohistory
> > > to true in the manifest. (http://developer.android.com/guide/topics/
> > > manifest/activity-element.html#nohist)
>
> > > On May 18, 9:10 am, blcooley <[email protected]> wrote:
>
> > > > In that case, you could build a "hub" Activity that can start each of
> > > > your four Activities via startActivityForResult, then have the
> > > > Activities call setResult, passing back an identifier that the hub
> > > > Activity inspects in onActivityResult and uses to determine the next
> > > > Activity to start.
>
> > > > That way, your Activities would get destroyed rather that stacking up
> > > > until the OS decided to destroy them to reclaim the memory. The bad
> > > > thing is that it might break user expectations with respect to the
> > > > back button.
>
> > > > On May 17, 9:09 pm, ls02 <[email protected]> wrote:
>
> > > > > The activity stack in my real app is not hard coded. A can start B, or
> > > > > C which can start D and D can start A or B or C depending on user
> > > > > selection or other flow. And this happens rather frequently. Each of
> > > > > them in reality should exist in only one instance and the activity
> > > > > should be shown or brought to top rather then re-created. However, I
> > > > > can handle re-creating activity when started from another activity, I
> > > > > just need to ensure that previous activity instance is completely
> > > > > destroyed and all its resources are de-alocated and freed.
>
> > > > > On May 17, 9:56 pm, blcooley <[email protected]> wrote:
>
> > > > > > If you need information from B to be fed back to A, then start B by
> > > > > > calling startActivityForResult. Then, when B exits, call setResult,
> > > > > > and A will be on top of the Activity stack and its onActivityResult
> > > > > > will fire.
>
> > > > > > If you don't need information from B, then you can start B using
> > > > > > startActivity. A will still be on top of the Activity stack when B
> > > > > > exits.
>
> > > > > > Best regards,
> > > > > > Brian Cooley
>
> > > > > > On May 17, 7:16 pm, ls02 <[email protected]> wrote:
>
> > > > > > > My understanding there is no way to start another activity reusing
> > > > > > > existing activity instance. Both startActivity and
> > > > > > > startActivityForResult create a new activity instance.
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > > > Groups "Android Developers" group.
> > > > > > To post to this group, send email to 
> > > > > > [email protected]
> > > > > > To unsubscribe from this group, send email to
> > > > > > [email protected]
> > > > > > For more options, visit this group 
> > > > > > athttp://groups.google.com/group/android-developers?hl=en
>
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > > > Groups "Android Developers" group.
> > > > > To post to this group, send email to 
> > > > > [email protected]
> > > > > To unsubscribe from this group, send email to
> > > > > [email protected]
> > > > > For more options, visit this group 
> > > > > athttp://groups.google.com/group/android-developers?hl=en-Hidequotedtext-
>
> > > > > - Show quoted text -
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
> > > > For more options, visit this group 
> > > > athttp://groups.google.com/group/android-developers?hl=en-Hidequotedtext
> > > >  -
>
> > > > - Show quoted text -
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group 
> > > athttp://groups.google.com/group/android-developers?hl=en
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group 
> > athttp://groups.google.com/group/android-developers?hl=en-Hide quoted text -
>
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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