On Tue, Mar 5, 2013 at 10:14 AM, Latimerius <l4t1m3r...@gmail.com> wrote:

> On Tue, Mar 5, 2013 at 4:41 PM, Piren <gpi...@gmail.com> wrote:
>
>> Not sure what the issues you mention, never had those... onPause/onResume
>> are pretty much the only lifecycle events that are constant in behavior :)
>>
>>
> I described it in my original post - in short, if the main activity is
> being paused because the user is leaving the app, a lot of things have to
> be closed, saved, cleaned up etc.  If it's being paused just to show
> preferences, those things should not happen.
>

I may have misses something, but from what you've described, I think you
might be overcomplicating things and should probably just be using the
lifecycle events. In this case, onDestroy for all this cleanup. onDestroy
will be called when the user leaves the app by pressing back. It will NOT
be called when they press Home, but that's expected because they're not *
leaving* the app, they're merely sending it to the background, so your app
should not completely shut down and should be ready to quickly resume
should the user switch back to it.

Eventually, if the user never returns to your app, it will be killed off by
the system and whether or not onDestroy gets called all your stuff will be
"closed" anyway.

However, if this is for a game, then I believe those are usually
implemented with a single Activity to allow you to better control resources
like graphics and music. Then you don't have the music playing issue you
describe since you just handle onPause / onStop to pause the music.

-------------------------------------------------------------------------------------------------
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
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to