I'm wondering if I am understanding the concepts of requestCode and resultCode properly? Basically, I have an arbitrary integer (the requestCode) associated with an activity. For example, in the Notepad tutorial, we have
private static final int ACTIVITY_CREATE=0;
private static final int ACTIVITY_EDIT=1;
We then use startActivityforResult(intent, requestCode) to start an activity, e.g. the "create note" activity. We do something in that activity and return a resultCode.
In the parent activity we detect the resultCode with onActivityResult(requestCode, resultCode, intent). We can then use the requestCode to see which activity is being returned, the resultCode to see the result of that activity, and the intent's "extras" to get returned data.
Is there anything special about the built-in resultCodes, like RESULT_CANCELED? The documentation on the developer site seems to suggest that the built-in results are simply integers.
And it seems to me that this could get really messy? For example, if I had 10 possible activities to launch, then I'd have to have a giant onActivityResult function to check which activity's being returned, wouldn't I?
Activity.RESULT_FIRST_USER
, i.e.static final int MY_RESULT = Activity.RESULT_FIRST_USER
and thenstatic final int MY_OTHER_RESULT = MY_RESULT + 1
– Keven