Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Tue, Dec 25, 2012 at 8:35 PM, TreKing treking...@gmail.com wrote: I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. According to Ms. Hackborn, this does not happen: http://stackoverflow.com/questions/7536988/android-app-out-of-memory-issues-tried-everything-and-still-at-a-loss/7576275#7576275 If you can provide a sample app and steps for reproducing the activities-get-destroyed-for-memory behavior, I'd love to see it! Also, even simpler, rotate your device. Activities destroyed. Processes, not so much. Correct. Ditto for any finish() scenarios (e.g., BACK, FLAG_ACTIVITY_CLEAR_TOP). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Aqui estão alguns sites onde você pode perguntar ou responder dúvidas sobre desenvolvimento de aplicações para Android: http://www.andglobe.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Wed, Dec 26, 2012 at 2:35 AM, TreKing treking...@gmail.com wrote: On Tue, Dec 25, 2012 at 3:04 PM, Latimerius l4t1m3r...@gmail.com wrote: The thing I don't get is how would that be possible if Android doesn't collect individual Activity instances, just whole processes. I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. Also, even simpler, rotate your device. Activities destroyed. Processes, not so much. Yes, you're right in general, however I should have mentioned that the setup of this particular app should, to the best of my knowledge, prevent those common causes of Activity destruction from happening. In particular, the application (which is a game, or perhaps a toy) only has a single Activity in which everything happens. Apart from that, there's only a rather seldom used, quite lightweight preference activity. Also, the manifest is set up so that things like device rotation handling is under application control and don't cause activity destruction. -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Wed, Dec 26, 2012 at 1:38 PM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Dec 25, 2012 at 8:35 PM, TreKing treking...@gmail.com wrote: I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. According to Ms. Hackborn, this does not happen: http://stackoverflow.com/questions/7536988/android-app-out-of-memory-issues-tried-everything-and-still-at-a-loss/7576275#7576275 I'm aware of that post, it just doesn't seem to match my experience. If you can provide a sample app and steps for reproducing the activities-get-destroyed-for-memory behavior, I'd love to see it! From what I see, it would be quite difficult to come up with a reliable repro. As I mentioned in my other post, the common causes of Activity destruction should be off in my case, and indeed for very long stretches of testing I'm used to only see onCreate() executing when I kill my process from DDMS and start it anew. The thing that made me suspect that individual Activities do get collected happened maybe twice, three times, and I believe it was always on customer devices. Is there an exhaustive list anywhere of conditions under which an Activity can be destroyed (and recreated) - things like device rotation under default handling? Perhaps there is one that I'm not aware of that only kicks in very seldom, or is tied just to a particular Android version? -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
Have you experimented with Don't keep activities in Settings Developer options? On Wednesday, December 26, 2012 4:17:06 PM UTC, latimerius wrote: On Wed, Dec 26, 2012 at 2:35 AM, TreKing treki...@gmail.com javascript: wrote: On Tue, Dec 25, 2012 at 3:04 PM, Latimerius l4t1m...@gmail.comjavascript: wrote: The thing I don't get is how would that be possible if Android doesn't collect individual Activity instances, just whole processes. I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. Also, even simpler, rotate your device. Activities destroyed. Processes, not so much. Yes, you're right in general, however I should have mentioned that the setup of this particular app should, to the best of my knowledge, prevent those common causes of Activity destruction from happening. In particular, the application (which is a game, or perhaps a toy) only has a single Activity in which everything happens. Apart from that, there's only a rather seldom used, quite lightweight preference activity. Also, the manifest is set up so that things like device rotation handling is under application control and don't cause activity destruction. -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Wed, Dec 26, 2012 at 11:30 PM, RichardC richard.crit...@googlemail.comwrote: Have you experimented with Don't keep activities in Settings Developer options? Nope, I haven't touched that (yet). -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Wed, Dec 26, 2012 at 6:38 AM, Mark Murphy mmur...@commonsware.comwrote: On Tue, Dec 25, 2012 at 8:35 PM, TreKing treking...@gmail.com wrote: I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. According to Ms. Hackborn, this does not happen: http://stackoverflow.com/questions/7536988/android-app-out-of-memory-issues-tried-everything-and-still-at-a-loss/7576275#7576275 If you can provide a sample app and steps for reproducing the activities-get-destroyed-for-memory behavior, I'd love to see it! Interesting. Thanks for the link. I was going off the docs you mention in the post. Though I swear I saw this behavior on my G1 ... I'll play around with it when I get back from vaca and post back. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Sun, Dec 23, 2012 at 10:43 PM, Lew lewbl...@gmail.com wrote: Instances do not initialize static members in Java. The static members are initialized as part of class initialization. Instances can set static values if they're mutable, but that's not initialization. I don't know about processes being destroyed or not, but the creation or collection of instances in a JVM is not related to the initialization or destruction of static members. If the class is not unloaded, its static variables will continue to hold whatever values they had at the point of latest assignment, or their initialized values if there hasn't been an assignment. If a class is unloaded and reloaded, or loaded under a different classloader for the first time, it will be (re-)initialized upon the first subsequent class-initialization event (such as a reference to a member or creation of an instance). So your question reduces to finding out under what circumstances the class under investigation is unloaded, loaded and initialized. Based on the answers upthread, and I'm in no position to dispute them, the class does not unload every time the Activity stops. But it sometimes does. I guess I was too terse. Here's my reasoning in a bit more detail so it's easier for you to understand. If, by the time onCreate() starts executing, the static data already have values that onCreate(), and no one else, writes to them, I'd say it means onCreate() has executed already. That would make the onCreate() call in question the second one (at least) since the class was loaded. The thing I don't get is how would that be possible if Android doesn't collect individual Activity instances, just whole processes. What you write is basic Java and doesn't contribute to the explanation I'm looking for. If you can think of a mechanism for static data to survive process termination and restart, that's what I'd like to hear. I don't know much about how Android works in this area. Normally, I'd expect process termination to mean JVM shutdown, with classes unloaded and destruction of static data. Could it be there's perhaps some advanced caching going on allowing classes and statics to survive? -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Tue, Dec 25, 2012 at 3:04 PM, Latimerius l4t1m3r...@gmail.com wrote: The thing I don't get is how would that be possible if Android doesn't collect individual Activity instances, just whole processes. I believe it is entirely possible and actually a frequent occurrence that Activities are destroyed while processes are not. For example, you might open a second Activity within your own app that causes memory pressure - your process must keep running to show the second Activity but the first Activity, which is now hidden, can be destroyed to reclaim memory. Also, even simpler, rotate your device. Activities destroyed. Processes, not so much. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
I tried finding it, couldn't. i think it was the video was from around 2008, one of the very early presentations of android memory management/activity lifecycle videos. I found a similar one but it only showed a whole process being taken down, not a single activity instance... so at this point i'm starting to think that i might just remember everything wrong and the fact the documentation stated the same, i just started believing it :) Funny that i did, considering i've never noticed this happening and i dealt a lot with memory management. ohh well... On Sunday, December 23, 2012 8:34:22 PM UTC+2, Todd wrote: A lot of Google's Android presentations are online. Can you provide a link or recall the time period during which that presentation was given? On Dec 23, 2012 7:00 AM, Piren gpi...@gmail.com javascript: wrote: thats really pissy... they said the exact opposite in one of their original android video presentations. they had a whole part showing how activities are being dropped if the activity stack gets too big to maintain them all. On Sunday, December 23, 2012 2:29:15 PM UTC+2, Mark Murphy (a Commons Guy) wrote: On Sun, Dec 23, 2012 at 4:08 AM, Piren gpi...@gmail.com wrote: documentation flaw? was android changed to no longer do that? I am not completely certain what aspect of my email your that is referring to. If you mean destroying activities to reclaim memory: http://commonsware.com/blog/**2011/10/03/activities-not-** destroyed-to-free-heap-space.**htmlhttp://commonsware.com/blog/2011/10/03/activities-not-destroyed-to-free-heap-space.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Här kan du ställa och svara på frågor om applikationsutveckling på Android: http://www.andglobe.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
documentation flaw? was android changed to no longer do that? i remember a presentation done by google mentioning this exact process as part of android's normal work... but that was years ago... can you point us to documentation stating otherwise? regarding onStop and onDestroy, under some conditions they are not called, but yeah.. what they wrote is just wrong. On Saturday, December 22, 2012 9:06:45 PM UTC+2, Mark Murphy (a Commons Guy) wrote: On Sat, Dec 22, 2012 at 1:59 PM, Jonathan S xfsu...@gmail.comjavascript: wrote: onDestroy - The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method. That is a documentation flaw. Android does not destroy this instance of the activity to save space, except by terminating the entire process. isFinishing() will distinguish multiple reasons for onPause() and onStop() being called (e.g., BACK will cause isFinishing() to return true, HOME will cause isFinishing() to return false). finish() will call onDestroy() but not onStop() False. What lifecycle methods will be called on an activity when finish() is called depends on the state of the activity at that time. If the activity has not yet been paused, onPause() will be called. If the activity has not yet been stopped, onStop() will be called. Then, onDestroy() will be called. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.4 Available! -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Sun, Dec 23, 2012 at 4:08 AM, Piren gpi...@gmail.com wrote: documentation flaw? was android changed to no longer do that? I am not completely certain what aspect of my email your that is referring to. If you mean destroying activities to reclaim memory: http://commonsware.com/blog/2011/10/03/activities-not-destroyed-to-free-heap-space.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Här kan du ställa och svara på frågor om applikationsutveckling på Android: http://www.andglobe.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
thats really pissy... they said the exact opposite in one of their original android video presentations. they had a whole part showing how activities are being dropped if the activity stack gets too big to maintain them all. On Sunday, December 23, 2012 2:29:15 PM UTC+2, Mark Murphy (a Commons Guy) wrote: On Sun, Dec 23, 2012 at 4:08 AM, Piren gpi...@gmail.com javascript: wrote: documentation flaw? was android changed to no longer do that? I am not completely certain what aspect of my email your that is referring to. If you mean destroying activities to reclaim memory: http://commonsware.com/blog/2011/10/03/activities-not-destroyed-to-free-heap-space.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Här kan du ställa och svara på frågor om applikationsutveckling på Android: http://www.andglobe.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
A lot of Google's Android presentations are online. Can you provide a link or recall the time period during which that presentation was given? On Dec 23, 2012 7:00 AM, Piren gpi...@gmail.com wrote: thats really pissy... they said the exact opposite in one of their original android video presentations. they had a whole part showing how activities are being dropped if the activity stack gets too big to maintain them all. On Sunday, December 23, 2012 2:29:15 PM UTC+2, Mark Murphy (a Commons Guy) wrote: On Sun, Dec 23, 2012 at 4:08 AM, Piren gpi...@gmail.com wrote: documentation flaw? was android changed to no longer do that? I am not completely certain what aspect of my email your that is referring to. If you mean destroying activities to reclaim memory: http://commonsware.com/blog/**2011/10/03/activities-not-** destroyed-to-free-heap-space.**htmlhttp://commonsware.com/blog/2011/10/03/activities-not-destroyed-to-free-heap-space.html -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Här kan du ställa och svara på frågor om applikationsutveckling på Android: http://www.andglobe.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Sat, Dec 22, 2012 at 8:06 PM, Mark Murphy mmur...@commonsware.comwrote: That is a documentation flaw. Android does not destroy this instance of the activity to save space, except by terminating the entire process. isFinishing() will distinguish multiple reasons for onPause() and onStop() being called (e.g., BACK will cause isFinishing() to return true, HOME will cause isFinishing() to return false). That's strange. What I see in an Activity that initialises some static data in its onCreate() is that occasionally, the statics are initialised already when onCreate() starts to execute. I thought this was a sign that a previous instance of the Activity (the one that initialised the static data presumably) had been destroyed but the process was not. Is there a better explanation? -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
latimerius wrote: Mark Murphy wrote: That is a documentation flaw. Android does not destroy this instance of the activity to save space, except by terminating the entire process. isFinishing() will distinguish multiple reasons for onPause() and onStop() being called (e.g., BACK will cause isFinishing() to return true, HOME will cause isFinishing() to return false). That's strange. What I see in an Activity that initialises some static data in its onCreate() is that occasionally, the statics are initialised already when onCreate() starts to execute. I thought this was a sign that a previous instance of the Activity (the one that initialised the static data presumably) had been destroyed but the process was not. Is there a better explanation? Instances do not initialize static members in Java. The static members are initialized as part of class initialization. Instances can set static values if they're mutable, but that's not initialization. I don't know about processes being destroyed or not, but the creation or collection of instances in a JVM is not related to the initialization or destruction of static members. If the class is not unloaded, its static variables will continue to hold whatever values they had at the point of latest assignment, or their initialized values if there hasn't been an assignment. If a class is unloaded and reloaded, or loaded under a different classloader for the first time, it will be (re-)initialized upon the first subsequent class-initialization event (such as a reference to a member or creation of an instance). So your question reduces to finding out under what circumstances the class under investigation is unloaded, loaded and initialized. Based on the answers upthread, and I'm in no position to dispute them, the class does not unload every time the Activity stops. But it sometimes does. There is only one better explanation, and that's a correct one. Yours was not. Distinguish between initialization and assignment. -- Lew -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
onDestroy - The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called * finish()* on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method. onStop - Called when the activity is no longer visible to the user, because another activity has been resumed and is covering this one. This may happen either because a new activity is being started, an existing one is being brought in front of this one, or this one is being destroyed. Followed by either onRestart() if this activity is coming back to interact with the user, or onDestroy() if this activity is going away. finish() will call onDestroy() but not onStop() -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
On Sat, Dec 22, 2012 at 1:59 PM, Jonathan S xfsuno...@gmail.com wrote: onDestroy - The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it, or because the system is temporarily destroying this instance of the activity to save space. You can distinguish between these two scenarios with the isFinishing() method. That is a documentation flaw. Android does not destroy this instance of the activity to save space, except by terminating the entire process. isFinishing() will distinguish multiple reasons for onPause() and onStop() being called (e.g., BACK will cause isFinishing() to return true, HOME will cause isFinishing() to return false). finish() will call onDestroy() but not onStop() False. What lifecycle methods will be called on an activity when finish() is called depends on the state of the activity at that time. If the activity has not yet been paused, onPause() will be called. If the activity has not yet been stopped, onStop() will be called. Then, onDestroy() will be called. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 4.4 Available! -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
Did you look in http://developer.android.com/guide/components/tasks-and-back-stack.html when you use singleTop On Friday, December 21, 2012 2:26:25 AM UTC-5, Amit Dwivedi wrote: i also have a similar problem... please have a look on my Detailed Questionhttp://stackoverflow.com/questions/13928591/a-strange-behavior-of-android-activities-fragments-and-intent -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
i also have a similar problem... please have a look on my Detailed Questionhttp://stackoverflow.com/questions/13928591/a-strange-behavior-of-android-activities-fragments-and-intent On Friday, October 15, 2010 5:25:18 PM UTC+5:30, Kumar Bibek wrote: While starting an Activity, use the Activity's context. I am not sure though what your problem is. On Fri, Oct 15, 2010 at 4:49 PM, mariush mariu...@gmail.com javascript: wrote: No, but how can i finish activity using Context, finish isn`t derived method and is available only in Activity class. On 15 Paź, 13:09, Kumar Bibek coomar@gmail.com wrote: Yep, in normal circumstances. Did you try using the Activity's context and see if it makes any difference? On Fri, Oct 15, 2010 at 4:33 PM, mariush mariusz...@gmail.com wrote: so after invoking finish() onDestroy and onStop must or should be invoked? Moreover, it not happens on all kind of devices, i can reproduce problem on HTC Legend with Android 2.1, but on Sony Ericsson Xperia X10 Android 1.6 everything is invoked as expected. My activity is running in singleInstance launchMode, when onDestroy and onStop isn`t invoked, and i`ll try to launch once again activity, new instance is created(thought old isn`t destroyed)... On 15 Paź, 04:43, Kumar Bibek coomar@gmail.com wrote: If you are finish an activity through code, onStop and onDestroy should be called. In extreme cases where the system kills your app, these two methods may or may not be called. I am sure, you are doing something wrong. Or may be it has got something related to reboot of phone. On Fri, Oct 15, 2010 at 2:02 AM, icedogchi icedog...@gmail.com wrote: onStop and onDestroy may or may not be called. onPause is the last method you are guaranteed will be called. Check out the activity life cycle: http://developer.android.com/reference/android/app/Activity.html On Oct 14, 1:04 am, mariush mariusz...@gmail.com wrote: Hi, i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but... Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()... I`ve noticed, that those calls are triggered after launching any other activity... Any ideas why this is happening? Regard Mariush -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.com javascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: android-developers%2Bunsubscr...@googlegroups.com javascript: android-developers%2Bunsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: android-developers%2Bunsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-d...@googlegroups.comjavascript: To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
Yep, in normal circumstances. Did you try using the Activity's context and see if it makes any difference? On Fri, Oct 15, 2010 at 4:33 PM, mariush mariusz...@gmail.com wrote: so after invoking finish() onDestroy and onStop must or should be invoked? Moreover, it not happens on all kind of devices, i can reproduce problem on HTC Legend with Android 2.1, but on Sony Ericsson Xperia X10 Android 1.6 everything is invoked as expected. My activity is running in singleInstance launchMode, when onDestroy and onStop isn`t invoked, and i`ll try to launch once again activity, new instance is created(thought old isn`t destroyed)... On 15 Paź, 04:43, Kumar Bibek coomar@gmail.com wrote: If you are finish an activity through code, onStop and onDestroy should be called. In extreme cases where the system kills your app, these two methods may or may not be called. I am sure, you are doing something wrong. Or may be it has got something related to reboot of phone. On Fri, Oct 15, 2010 at 2:02 AM, icedogchi icedog...@gmail.com wrote: onStop and onDestroy may or may not be called. onPause is the last method you are guaranteed will be called. Check out the activity life cycle: http://developer.android.com/reference/android/app/Activity.html On Oct 14, 1:04 am, mariush mariusz...@gmail.com wrote: Hi, i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but... Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()... I`ve noticed, that those calls are triggered after launching any other activity... Any ideas why this is happening? Regard Mariush -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
While starting an Activity, use the Activity's context. I am not sure though what your problem is. On Fri, Oct 15, 2010 at 4:49 PM, mariush mariusz...@gmail.com wrote: No, but how can i finish activity using Context, finish isn`t derived method and is available only in Activity class. On 15 Paź, 13:09, Kumar Bibek coomar@gmail.com wrote: Yep, in normal circumstances. Did you try using the Activity's context and see if it makes any difference? On Fri, Oct 15, 2010 at 4:33 PM, mariush mariusz...@gmail.com wrote: so after invoking finish() onDestroy and onStop must or should be invoked? Moreover, it not happens on all kind of devices, i can reproduce problem on HTC Legend with Android 2.1, but on Sony Ericsson Xperia X10 Android 1.6 everything is invoked as expected. My activity is running in singleInstance launchMode, when onDestroy and onStop isn`t invoked, and i`ll try to launch once again activity, new instance is created(thought old isn`t destroyed)... On 15 Paź, 04:43, Kumar Bibek coomar@gmail.com wrote: If you are finish an activity through code, onStop and onDestroy should be called. In extreme cases where the system kills your app, these two methods may or may not be called. I am sure, you are doing something wrong. Or may be it has got something related to reboot of phone. On Fri, Oct 15, 2010 at 2:02 AM, icedogchi icedog...@gmail.com wrote: onStop and onDestroy may or may not be called. onPause is the last method you are guaranteed will be called. Check out the activity life cycle: http://developer.android.com/reference/android/app/Activity.html On Oct 14, 1:04 am, mariush mariusz...@gmail.com wrote: Hi, i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but... Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()... I`ve noticed, that those calls are triggered after launching any other activity... Any ideas why this is happening? Regard Mariush -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com android-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: OnStop and OnDestroy aren`t invoked after calling finish()
If you are finish an activity through code, onStop and onDestroy should be called. In extreme cases where the system kills your app, these two methods may or may not be called. I am sure, you are doing something wrong. Or may be it has got something related to reboot of phone. On Fri, Oct 15, 2010 at 2:02 AM, icedogchi icedog...@gmail.com wrote: onStop and onDestroy may or may not be called. onPause is the last method you are guaranteed will be called. Check out the activity life cycle: http://developer.android.com/reference/android/app/Activity.html On Oct 14, 1:04 am, mariush mariusz...@gmail.com wrote: Hi, i`ve got some problems with finish() method. I expect what after calling on my Activity finish() method onStop and onDestroy must be triggered(or am wrong??), in majority of examples they are, but... Scenario: - reboot phone - launch activity - invoke finish() onPause is triggered but afterwards they are no calls to onStop() and onDestroy()... I`ve noticed, that those calls are triggered after launching any other activity... Any ideas why this is happening? Regard Mariush -- 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 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- 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 android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en