My understanding there is no way to start another activity reusing
existing activity instance. Both startActivity and
startActivityForResult create a new activity instance.

The sample app I describes shows very common scenario to my opinion.
An app can have several activities that can start one another in any
combination.

To me it is very strange that there is no way to reuse existing
activity instance. If the activity instance already exists what I
would like to do is to just bring it to the top of the stack similar
to pressing Back button.


On May 17, 7:38 pm, blcooley <[email protected]> wrote:
> On May 17, 5:20 pm, ls02 <[email protected]> wrote:
>
> > We found there are very nasty memory and resource leaks in activities
> > and views that we don't know how to handle. I have test app that
> > basically starts activity A, that immediately starts activity B and B
> > starts A and so forth in infinite loop. Each activity displays its own
> > bitmap in image view. After X cycles JVM runs out of memory. There are
> > no static or any other references to bitmaps or views or anything
> > else.
>
> Is it absolutely necessary to start the Activities in that manner? It
> seems to me that the source of your problem is that you are stacking
> up a bunch of Activity instances. Can you just return from B back to
> A, possibly using startActivityForResult if you need to exchange data
> between the Activities?
>
> When you start a new Activity, the previous activity doesn't
> necessarily get garbage collected. Check out the Activity 
> lifecycle:http://developer.android.com/guide/topics/fundamentals.html
>
> --
> 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