On Sun, Jul 4, 2010 at 7:21 PM, Indicator Veritatis <mej1...@yahoo.com> wrote:
> 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.

Generally, I'd recommend the implementations be independent. Wherever
possible, onStop() should not care whether or not onPause() preceded
it, even though most of the time, it will. That's pretty basic state
machine design.

> 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.

I'm not arguing that it'd be nice if the docs explained the
circumstances of all of these corner cases better.

> 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().

I am sincerely hoping that somebody who overrides onBackPressed() will
notice that their fingers typed those keystrokes and will therefore
consider that, gee, maybe onBackPressed() might have something to do
with what happens when BACK is pressed. I am not aware of any supplied
Activity implementation (e.g., ListActivity) that overrides
onBackPressed(), so such behavior will not be hidden too often.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://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

Reply via email to