Mark, thanks for the pointers.

When I said onStop() and onDestroy() don't get called, all I know is I
overrode them, set breakpoints inside them, and I never hit those
breakpoints.  In any case, your solution worked perfectly.

The reason for all this is as an exercise I'm doing a rough
reimplementation of AlarmClock with some tweaks and they use
PreferencesActivity for each alarm's settings just for its nice layout
of per alarm settings but they never actually use the preferences that
get set, they just handle the On* events and instantly apply to their
content provider for alarms.  I'm not at the point where I have
implemented the content provider yet so I want to pass updated
variables back to the main activity using extras.  (Just in case you
were wondering).

It has been an interesting exercise anyway.



On Jul 21, 4:50 pm, Mark Murphy <[email protected]> wrote:
> eags wrote:
> > I am trying to set the result in a PreferencesActivity so I can look
> > at extras in the caller inside onActivityResult.
>
> > The problem is that in onActivityResult(int requestCode, int
> > resultCode, Intent data), resultCode is always set to 0
> > (RESULT_CANCELLED) and the data is always null.
>
> > This sort of makes sense since the way one returns from a settings
> > dialog is by pressing back but I want to override the default
> > behavior.
>
> > I tried putting setResult in an overridden version of onPause (which
> > does get called but doesn't work), onStop (which never actually gets
> > called), and onDestroy (which never actually gets called either).
>
> onStop() and onDestroy() most likely do get called, since they are
> implemented in PreferenceActivity.
>
> However, they do seem to be useless for setResult(), at least when I
> tried doing what you're trying to do for a PreferenceActivity in support
> of an AppWidget.
>
> > It seems like there should be a way to do this.
>
> The best answer I found was to override onKeyDown() and watch for the
> back button, then call setResult() from in there.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> _Beginning Android_ from Apress Now Available!
--~--~---------~--~----~------------~-------~--~----~
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