Why both onPause() and onStop()?  Looking at the application lifecycle
diagram

http://developer.android.com/images/activity_lifecycle.png

it's not possible to get to onStop() without going through onPause().

If however, you have found this not to be the case, I will have to
change my programs and also deal with possible exceptions from
resources being released twice.

Do you have a simple test as I have never seen this (onPause being
skipped) happen?

/Richard

On 26 June, 17:13, mahesh <askmah...@gmail.com> wrote:
> And you have to unregister it in your OnPause() and onStop().
>
> Just as ref if you do not know this already -
> OnPause() is called when you quit the application via the back button
> or start another app.
> OnStop() is called when it is actually killed (via task manager)
>
> -
> maheshhttp://android.maheshdixit.com
>
> On Jun 25, 2:25 pm, Mark Murphy <mmur...@commonsware.com> wrote:
>
> > On Fri, Jun 25, 2010 at 5:21 PM, Flamechamp <flamechamp1...@yahoo.com> 
> > wrote:
> > > This may sound stupid, but I have a problem with my application.
> > > I made an application to check the accelerometer and orientation
> > > sensor.
> > > I tested it on my Nexus One and it works.
> > > The problem starts when I close it. (I pressed the <- button in the
> > > phone) When I checked the Battery usage. That program I made is still
> > > there.
>
> > You also need to be sure to unregister your sensor listeners. If you
> > do not, your program will not truly end, and you will continue
> > receiving sensor data.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.6
> > Available!

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