That is what the diagram says, yes. But the text of the table says something different: it says onPause() is called "when the system is about to resume another activity". But it also says that onStop() may be called when the activity is no longer visible to the user".
More importantly, it says that this may happen EITHER because another activity is being resumed (in which case onPause() will be called) OR "because it (the current activity) is being destroyed". The implication is that no, we cannot count on onPause() being called before onStop() is called, even if this is by far the more common case. Similarly, the same table says elsewhere that the next state for onStart() can be EITHER onResume() OR onStop(). Again, no stop at onPause(). Finally, I should point out that in http://developer.android.com/guide/topics/fundamentals.html#actlife, the doc we are all following to discuss this issue, it says explicitly that this table offers MORE detail than the diagram ("following table describes each of these methods in more detail"). That implies that the diagram is incomplete, but the table is if not complete, at least more complete. In a formal spec, the distinction would probably have been 'normative' versus 'reference'. But the Android online docs do not use this terminology. On Jun 26, 4:51 pm, RichardC <richard.crit...@googlemail.com> wrote: > Why both onPause() and onStop()? Looking at the application lifecycle > diagram > > http://developer.android.com/images/activity_lifecycle.png > > it's not possible to get to onStop() without going through onPause(). > > If however, you have found this not to be the case, I will have to > change my programs and also deal with possible exceptions from > resources being released twice. > > Do you have a simple test as I have never seen this (onPause being > skipped) happen? > > /Richard > > On 26 June, 17:13, mahesh <askmah...@gmail.com> wrote: > > > And you have to unregister it in your OnPause() and onStop(). > > > Just as ref if you do not know this already - > > OnPause() is called when you quit the application via the back button > > or start another app. > > OnStop() is called when it is actually killed (via task manager) > > > - > > maheshhttp://android.maheshdixit.com > > > On Jun 25, 2:25 pm, Mark Murphy <mmur...@commonsware.com> wrote: > > > > On Fri, Jun 25, 2010 at 5:21 PM, Flamechamp <flamechamp1...@yahoo.com> > > > wrote: > > > > This may sound stupid, but I have a problem with my application. > > > > I made an application to check the accelerometer and orientation > > > > sensor. > > > > I tested it on my Nexus One and it works. > > > > The problem starts when I close it. (I pressed the <- button in the > > > > phone) When I checked the Battery usage. That program I made is still > > > > there. > > > > You also need to be sure to unregister your sensor listeners. If you > > > do not, your program will not truly end, and you will continue > > > receiving sensor data. > > > > -- > > > Mark Murphy (a Commons > > > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > > > _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6 > > > Available! > > -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en