Meryl Silverburgh wrote:
> Hi,
> 
> I have read 
> 'http://developer.android.com/guide/tutorials/notepad/notepad-ex2.html',
> specifically step 4 about how to communicate between 2 activities.
> 
> It has this example:
> Intent i = new Intent(this, NoteEdit.class);
> startActivityForResult(i, ACTIVITY_CREATE);
> 
> But how can I return a different result to the 'calling activity', in
> this example, it always return ACTIVITY_CREATE.

ACTIVITY_CREATE is not a "result". It is an identifier indicating which
startActivityForResult() call is associated with the onActivityResult()
callback. That is why the parameter is called requestCode in the API
documentation.

The called activity can call setResult() to supply the resultCode
provided to onActivityResult().

> What if the 'activity being launcher' has a 'okay' and a 'cancel'
> button. How can the 'calling activity' knows which button user presses
> in  the 'activity being launcher'

Use setResult() in the called activity.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

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