Hi, Mark- As I should have expected for someone who did write a good book on Android, I see your knowledge of the Android life-cycle really is better than mine. But I am seeing something else that vitiates this superior knowledge, your habit of stating unconditionally, in a very general form, things that are only sometimes true.
For that is what you have done in both issues: 1) the issue of whether or not there is a direct transition to the stopped state and 2) the issue of whether it is true that Back always caused onDestroy() to be called. In neither case is your sweeping generalization justifiable, in both cases you are misleading readers rather than helping them. Do you really want to encourage, for example, Android programmers to fail to handle correctly the case where onStop() is called without a preceding, corresponding call to onPause()? Such programming sounds very careless to me. Even if most of the time (even your 99.999% is an overstatement), the programmer can ignore this scenario, he should be aware that it exists, so then when he needs to take care of it, he knows that he needs to do so. Similarly with the second issue: even Google violates the rule [that onBackPressed() should cause onDestroy() to be called] often enough that your readers are going to be confused if they forget that some apps really do override onBackPressed(), they don't all call onDestroy(). Finally, yes the docs are wrong. I already showed how they contradict each other. And others have found other similar contradictions in the docs. Take a look at my previous posts on this and see for yourself: I provided the direct quotations. On Jul 4, 2:14 am, Mark Murphy <mmur...@commonsware.com> wrote: > On Sat, Jul 3, 2010 at 7:42 PM, Indicator Veritatis <mej1...@yahoo.com> wrote: > > That may be true, but if so, there is a serious problem with the > > online Android documentation. For as I have already shown, the > > documentation clearly states that there is a possible transition > > direct from the started state to the stopped state, one that does not > > call onPause() first. > > That would occur in fairly rare cases, when something occurs on the > device after onStart() and before onResume(). Since those methods are > invoked in rapid succession, something else taking over the screen > (e.g., phone call comes in) during that window is rather unlikely. > Developers should not be worrying about that particular scenario very > much, if at all. > > > So other than your own authority, on what grounds do you say that the > > docs are wrong? > > The docs are not wrong. However, my previous post was covering the > 99.999% case, not every possible scenario. > > On Sat, Jul 3, 2010 at 7:50 PM, Indicator Veritatis <mej1...@yahoo.com> wrote: > > This is certainly wrong. > > No, it is certainly correct. > > > Pressing the Back key does NOT cause > > onDestroy() to be called. > > Yes, it does. > > > It causes onPause() to be called. > > And onStop(), and onDestroy(). > > > I have run > > this in the emulator too many times myself to believe that it does. > > I even had to run my own test, just to confirm I hadn't slid into some > parallel dimension, before writing my previous post. onDestroy() is > called after the BACK button is pressed, just like it is supposed to. > It has behaved this way for over two years. > > If you are unable to replicate this, there is a problem in your > development environment. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy > > Android Consulting:http://commonsware.com/consulting -- 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