Achanta wrote:
> I understand that trying to capture home button clicks is a hack, but
> I need to atleast close my current activity when the user clicks on
> home button.

<snip>

> I need to do it as I am listening for location updates and I want to
> stop the updates and also need to trash any location that was
> available to me previously.

Then stop location updates in onStop(). This will get invoked:

-- when the user presses HOME
-- when the user pressed BACK (en route to onDestroy())
-- when the user takes a phone call
-- when the user responds to a notification that brings up an activity
-- etc.

The one thing you may want to do is handle configuration changes
yourself, so you won't be called with onStop() when the user rotates the
screen.

> I need to do this just in case any user while in that activity clicks
> on home button and changes the location settings.

I'm not sure what "the location settings" are. If you mean they disable
GPS, your LocationListener should be notified of that.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 26-30 April 2010: http://onlc.com

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

Reply via email to