Thanks for your sensible suggestion. My sentence should have read 'I have a timer thread that should not bring an activity back to view after the home button has been pressed but it does.'
On Jun 11, 1:02 am, Indicator Veritatis <mej1...@yahoo.com> wrote: > @Droid- > > You do realize, I hope, since it is the level of logic that should be > easily expected of any programmer, that what you wrote here makes no > sense. > > If, after all, on the one hand, "My thread is a timer thread that > brings my activity back to view after > thehome buttonis pressed". then no, it makes NO sense to "cancel it > whenhome buttonis pressed." > > Besides: if it is a timer thread, shouldn't you really mean that it > "bring your activity back to view" after the timer expires? It would > make sense to cancel that timer when Home is pressed. And you can do > that in onPause() or in onStop(). In fact, you should probably do that > in onStop() no matter how you get there This would also simplify your > code, since it is by design that the platform does not TELL you how > you got to onStop(): it certainly does not tell you that it got there > via a Home key. > > Also as has been pointed out many times now, overriding the expected > result of the Home key is a really, REALLY bad idea. It is a good > thing that the platform makes this difficult. It should not be done at > all. > > Now I realize that some customers insist on this 'feature', even > though it is such a bad idea. In which case, I pity you, but keep on > slogging ahead. It is possible to get close to what you want, either > with a custom Home application or some even more kludgy approach. But > ignore Fung's suggestion, since he is dead wrong. > > On Jun 10, 8:52 am, Droid <rod...@gmail.com> wrote: > > > > > My thread is a timer thread that brings my activity back to view after > > thehome buttonis pressed. I need to cancel it whenhome buttonis > > pressed. > > (I have 10 activities and no idea in which activity the app was when > > thehome buttonwas pressed) > > > On Jun 8, 1:23 pm, TreKing <treking...@gmail.com> wrote: > > > > On Wed, Jun 8, 2011 at 1:34 AM, Droid <rod...@gmail.com> wrote: > > > > I have a thread that needs specifically to be cancelled when the > > > >home buttonis pressed. > > > > Perhaps if you explain why you think your thread needs to be specifically > > > canceled on pressing Home you can get an answer that helps you fix your > > > actual problem and not hack around it. > > > > --------------------------------------------------------------------------- > > > ---------------------- > > > 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