Re:

- setResult() in client.onPause() is called TOO LATE; the result has
already been transmitted to the parent (although the method
client.onPause() seems to be called in time).

If the result has been already set, this means that the result value
is CANCELLED immediately after your child activity started.
Read carefully about the launchMode property -
http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

Cheers

On Wed, Mar 4, 2009 at 12:59 PM, Chronos <g358279012044...@gmail.com> wrote:
>
> Hello there ;)
>
> I have some - maybe simple - problem; unfortunately I cannot find a
> solution:
>
> I have two activities which communicate via: startActivityForResult(),
> setResult(), onActivityResult. I will call the first activity "parent"
> and the second one "client", although this may not be technically
> correct; so the order of calls must be:
>
> parent.startActivityForResult()
> client.setResult()
> parent.onActivityResult()
>
> Now, where should I call setResult in the client activity ?
>
> I have already tried various possibilities which have all failed:
>
>  - setResult() in client.onPause() is called TOO LATE; the result has
> already been transmitted to the parent (although the method
> client.onPause() seems to be called in time).
>  - client.onSaveInstanceState() is not guaranteed to be called at all
> (and the documentation hints at the same timing problem).
>  - The only TECHNICALLY POSSIBLE solution seems to implement a change-
> listener for any screen element and set the result there. This may
> work in theory, but is NOT VIABLE in practice: (1) it is strenuous and
> error-prone for activities with many elements; (2) it gets even more
> complicated, when side-effects kick in (change one field in dependency
> to another); (3) it is really slow, since one must write ALL contents
> any time, a SINGLE element changes (and the generic Intent
> communication is already slow by design).
>
> To me, it would seem most natural to overload the onPause() method and
> setResult() there - once and for all. There MUST be some easier way
> than implementing zounds of listeners ...
>
>
> Am I overlooking something ? Another listener I haven't stumbled over
> yet ? Please prove me wrong ;)
>
> >
>

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

Reply via email to