Frankly, I've never been clear on what exactly onDestroy() is good for.  At
any rate, it doesn't seem to be a good match to solve my problem as first,
it's not even guaranteed to be called, and second, even if it is called,
its docs specifically warn against using it to save data, saying that needs
to be done in onPause() - so I'm back to square one.

All in all, a function that may or may not be called isn't a good place to
deal with things that I need to make sure are done, especially if some of
those things are explicitly not recommended to be done in that function. :-(


On Tue, Mar 5, 2013 at 2:38 AM, Lew <lewbl...@gmail.com> wrote:

> RichardC wrote:
>
>> http://developer.android.com/**reference/android/app/**
>> Activity.html#isFinishing()<http://developer.android.com/reference/android/app/Activity.html#isFinishing()>
>>
>>
>>  latimerius wrote:
>>>
>>> Hello,
>>>
>>> I would like to be able to tell if Activity.onPause() was called because
>>> the user is leaving the app, or simply because another Activity within the
>>> same app is coming up.
>>>
>>> I have a main Activity and a PreferenceActivity.  The main Activity
>>> needs to handle onPause() differently depending on why it's called.  If the
>>> user is leaving the app, it needs to stop helper threads, close various
>>> things like analytics session, deal with GL, save data to SD card etc.
>>>  However, if onPause() is just to display prefs most of that should happen,
>>> and a bunch of other things should be done instead.
>>>
>>> I'm wondering if there's a framework-supported way to handle this, or at
>>> least an idiomatic solution, as in a (semi)standard way of managing an
>>> Activity with heavy set-up and tear-down?
>>>
>>
> Also:
> "onDestroy(): Called before the activity is destroyed. This is the final
> call that the activity will receive.
> It could be called either because the activity is finishing (someone called
>  
> finish()<http://developer.android.com/reference/android/app/Activity.html#finish()>
>  on it), or because
> the system is temporarily destroying this instance of the activity to save
> space. You can distinguish
> between these two scenarios with the 
> isFinishing()<http://developer.android.com/reference/android/app/Activity.html#isFinishing()>
>  method."
> http://developer.android.com/guide/components/activities.html#Lifecycle
>
> This passage doesn't reveal that 'isFinishing()' is available during
> 'onPause()', so it's good to have that
> Javadoc reference that RichardC shared.
>
> --
> Lew
>
>  --
> --
> 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.
>
>
>

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