[android-developers] Re: When to setResult for onActivityResult

2009-04-07 Thread Chronos
Overriding Activity.finish() does the job;) Thank you very much, Tseng @dianne: ALL samples in the SDK use this mechanism - I already lined out in my first post, that I didn't like overriding change listeners, since it is the most useless way I can think about. So, the following should be done

[android-developers] Re: When to setResult for onActivityResult

2009-03-22 Thread Tseng
On Mar 5, 11:11 am, Chronos g358279012044...@gmail.com wrote: @Tseng: I can't find this method - are you talking about class Activity ? Yes, the final() method is belongs to the activity class and you can override it and put your code there. That's how i did it in my activity class:

[android-developers] Re: When to setResult for onActivityResult

2009-03-21 Thread havexz
I am also suffering from the same problem.What I think one should be able to call setResult till the last life cycle state OnDestroy On Mar 5, 5:11 am, Chronos g358279012044...@gmail.com wrote: @Tseng: I can't find this method - are you talking about class Activity ? So, let me get this

[android-developers] Re: When to setResult for onActivityResult

2009-03-21 Thread Dianne Hackborn
On Fri, Mar 20, 2009 at 11:30 PM, havexz bali.param...@gmail.com wrote: I am also suffering from the same problem.What I think one should be able to call setResult till the last life cycle state OnDestroy You can't because the previous activity has receive the result from you and resumed

[android-developers] Re: When to setResult for onActivityResult

2009-03-05 Thread Chronos
@Tseng: I can't find this method - are you talking about class Activity ? So, let me get this straight: there are just two possible ways to setResult(): - Either: setResult() in your change listeners after data (even the slightest bit) changes in your activity - Or: present a dedicated GUI

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Stoyan Damov
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

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Stoyan Damov
Actually read carefully http://developer.android.com/reference/android/app/Activity.html#startActivityForResult(android.content.Intent,%20int) On Wed, Mar 4, 2009 at 1:31 PM, Stoyan Damov stoyan.da...@gmail.com wrote: Re: - setResult() in client.onPause() is called TOO LATE; the result has

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Chronos
Thanks for the idea - but this is not my problem: the result sent is the result I set in the onCreate method (a default result); if I fail to do this, I will get a java.lang.NullPointerException, which underlines my point - setResult() in onPause() is too late; my activity is not cancelled either

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Stoyan Damov
On Wed, Mar 4, 2009 at 2:41 PM, Chronos g358279012044...@gmail.com wrote: Thanks for the idea - but this is not my problem: the result sent is the result I set in the onCreate method (a default result); if I fail to do this, I will get a java.lang.NullPointerException, which underlines my

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Chronos
You should set the result when your child activity is about to exit - for example I set the result from my child activity when a button is clicked and just before exiting it, e.g.: // in a button click handler setResult(...); finish(); This is the way they do it in the samples, but it

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Stoyan Damov
So you really don't want to *return*, hence the setResult() isn't appropriate in your case. You just want to communicate something back to the parent activity, is that right? In this case you want to use a broadcast receiver. Cheers On Wed, Mar 4, 2009 at 3:28 PM, Chronos

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Chronos
Thanks for your input ;) I'm also discussing this with my colleagues - and I consider this either a bug or a design flaw... onPause() should be guaranteed to run before onActivityResult() - in more detail: setResult() in onPause() should have an effect in onActivityResult(). On Mar 4, 3:03 pm,

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Tseng
I recently had the same problem with onPause/onStop being to late to send it. I've solved it by overwriting onFinish() method. This one is always called before onPause and there it will work. Probably this can help in your case too On Mar 4, 3:20 pm, Chronos g358279012044...@gmail.com wrote:

[android-developers] Re: When to setResult for onActivityResult

2009-03-04 Thread Dianne Hackborn
You can call it a design flaw, but the design is that at the point you say to finish your activity, the current result is bundled up and delivered, and than we go through the normal pause etc flow to transition from that activity to the previous. At this point in time this just isn't going to