[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread blcooley
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,

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread blcooley
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 blcoo...@gmail.com wrote: In that case, you could build a hub Activity that can start

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread ls02
Thank you. This is very useful advise that I already verified in my test app as working. Small problem is it seems the hub activity flickers a bit when launching next activity from onActivityResult (it does not flicker the first time when startActivityForResult is called from the hub's onCreate).

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread ls02
nohistory does not work. The app runs out of memory. On May 18, 12:33 pm, blcooley blcoo...@gmail.com 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

Re: [android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread TreKing
On Tue, May 18, 2010 at 12:04 PM, ls02 agal...@audible.com wrote: nohistory does not work. The app runs out of memory. Have you looked at the singleTask flag? - TreKing - Chicago transit tracking

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread Streets Of Boston
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 agal...@audible.com wrote: nohistory does not work. The app runs out of memory. On May

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread ls02
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

Re: [android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread Kostya Vasilyev
You could also be more proactive with releasing unneeded objects. Rather than doing it in finalize (if that is how you do it), do object cleanup in onPause. 18.05.2010 23:12 пользователь ls02 agal...@audible.com написал: Yes, this is really what I need. Though I see that periodically my

[android-developers] Re: Memory leaks in activities and views

2010-05-18 Thread ls02
I am not releasing objects in finalize. I just log all standard methods to observe when they are called. My understanding that singleTask activity is a singleton object that should not be destroyed and one single instance should be reused. This does not happen. Sometimes the activity's constructor

[android-developers] Re: Memory leaks in activities and views

2010-05-17 Thread blcooley
On May 17, 5:20 pm, ls02 agal...@audible.com 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

[android-developers] Re: Memory leaks in activities and views

2010-05-17 Thread ls02
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

[android-developers] Re: Memory leaks in activities and views

2010-05-17 Thread ls02
There is nothing special in my sample app. It is bare born simple app that consits of may be 50 lines of code and two classes. If you wish, I can send you source code, you can see for yourself. Again, there is no static or non-static members in any of the classes. On May 17, 6:26 pm, Romain Guy

[android-developers] Re: Memory leaks in activities and views

2010-05-17 Thread blcooley
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

[android-developers] Re: Memory leaks in activities and views

2010-05-17 Thread ls02
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