The task managers you mention are the exception I had in mind to the rule, so that I said "overwhelming majority of" instead of "all" in "The overwhelming majority of applications should never call System.exit()". But I did not mention them explicitly, since I did not want to give the impression that they are absolutely the only such exception.
In any case, by now I am sure the OP has an answer to his question, and knows that he should be overriding lifecycle callbacks instead of calling System.exit(). On Apr 28, 5:08 pm, Miguel Morales <[email protected]> wrote: > There are some issues with the documentation, specially in regards as to how > one should handle the lifecycle appropriately. Although, granted there are > several scenarios so there's no 'best practice' but rather 'best practice > depending on what you are doing.' > So it's probably not easy to make such a document, and it's true that right > now only experience really teaches you which practice to use when. > > However, you DO NOT need to call system.exit() even when you opt to have an > 'exit' button. > You simply finish your activity, stop any services/threads. Your app will > be shut down eventually and you won't be hogging any resources beside RAM > which doesn't affect battery life AFAIK. > > You can have an exit button, and not need to call exit. Only task managers > might pick up the process, but A) those are power users B) task managers are > flaky/unreliable with all apps on Android. Including stock ones. As such > developers shouldn't make attempts to make their apps compatible with task > managers. > > On Thu, Apr 28, 2011 at 4:54 PM, Indicator Veritatis <[email protected]>wrote: > > > You are directing this to the wrong person. I do not call > > System.exit() in any of my shipping code, not in Android, not in Sun > > Java. But I have to agree with lbendlin's comments about the "paranoid > > user". Yet at the same time, once corrected for the logical mistakes > > in expression whose criticism Dianne rashly takes as personal, I have > > to agree with almost all of what Dianne said. The overwhelming > > majority of applications should never call System.exit(), especially > > since, as Dianne already pointed out, it does not even guarantee > > accomplishing what the OP asked of it. The right way is to use > > finish() and/or overload the lifecycle callbacks, e.g. onStop(), > > onDestroy() etc. > > > Finally, Google will see more people following these "best practices" > > and less fruitless arguments about what they are only when the > > hopelessly vague, outdated, or outright erroneous expression of those > > "best practices" in the online documentation are corrected. Several > > people have pointed this out several times by now (it isn't just me > > anymore), yet NOTHING has been done about it. For someone who knows > > what he is doing, it would take all of about 15 minutes of editing, > > but it seems Google would rather thousands around the world waste > > their time learning the hard way instead. > > > On Apr 28, 3:04 pm, Miguel Morales <[email protected]> wrote: > > > Calling System.exit() or even asking for it tells me that your code flow > > is > > > seriously flawed. > > > The lifecycle of a mobile app is complex, and as such you should follow > > best > > > practices. > > > > On Thu, Apr 28, 2011 at 2:43 PM, Indicator Veritatis <[email protected] > > >wrote: > > > > > I have worked for companies where even highly experienced and > > > > otherwise valuable employees were fired for making posts like the one > > > > you made here. > > > > > On Apr 26, 6:37 am, Dianne Hackborn <[email protected]> wrote: > > > > > You are ignore all of the other replies I didn't make to other > > threads > > > > > because of you. > > > > > > On Tue, Apr 26, 2011 at 9:33 AM, Indicator Veritatis < > > [email protected] > > > > >wrote: > > > > > > > Actually, I think the post has had the desired effect, since Dianne > > > > > > has updated her answer with one that more directly addresses the > > OP's > > > > > > question, explaining that calling System.exit() can actually be > > > > > > harmful, rather than just being always unnecessary. > > > > > > > Oh, and those fancy terms ARE English. Their technical meanings in > > > > > > logic are explained at the web sites I used as references for the > > > > > > product description for SylloGizmo on slidme.org ( > >http://slideme.org/ > > > > > > application/syllogizmo) as well as at the Stanford Encyclopedia of > > > > > > Philosophy's entry for the Square of Opposition, > > > > > >http://plato.stanford.edu/entries/square/ > > > > > > > Contraries go straight up and down in the Square, contradictories > > go > > > > > > along the diagonals. > > > > > > > On Apr 25, 5:46 pm, TreKing <[email protected]> wrote: > > > > > > > On Mon, Apr 25, 2011 at 7:39 PM, Indicator Veritatis < > > > > [email protected] > > > > > > >wrote: > > > > > > > > > In fact, one could believe you had answered it only if you > > confused > > > > the > > > > > > > > contrary and the contradictory of a non-null affirmative > > > > categorical > > > > > > > > statement. > > > > > > > > > In fact, the mismatch between his question and your 'answer' is > > > > giving > > > > > > me > > > > > > > > good ideas for how to update SylloGizmo to support using the > > Square > > > > of > > > > > > > > Opposition in entering and analyzing categorical syllogisms;) > > > > > > > > I'm a little slow, so I may be the only that didn't understand a > > word > > > > of > > > > > > > that. Your proficiency with a dictionary and thesaurus is > > impressive, > > > > but > > > > > > if > > > > > > > you have a point to make, you might want to make it in English so > > the > > > > > > rest > > > > > > > of us can follow along =P > > > ------------------------------------------------------------------------------------------------- > > > > > > > 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 > > > > [email protected] > > > > > > To unsubscribe from this group, send email to > > > > > > [email protected] > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/android-developers?hl=en > > > > > > -- > > > > > Dianne Hackborn > > > > > Android framework engineer > > > > > [email protected] > > > > > > Note: please don't send private questions to me, as I don't have time > > to > > > > > provide private support, and so won't reply to such e-mails. All > > such > > > > > questions should be posted on public forums, where I and others can > > see > > > > and > > > > > answer them. > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to > > [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected] > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > > ~ Jeremiah:9:23-24 > > > Android 2D MMORPG: > >http://solrpg.com/,http://www.youtube.com/user/revoltingx > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > ~ Jeremiah:9:23-24 > Android 2D MMORPG:http://solrpg.com/,http://www.youtube.com/user/revoltingx -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

