Hi again guys,
I'm trying to launch a sub-activity from my "main" activity and
although the sub-activity does launch (and it's view gets shown), the
parent activity's onActivityResults always gets called back with a
result of RESULT_CANCELED immediately after I call
startActivityForResult (and then the sub-activity gets launched).
Here's the main activity's relevant code:
private void launchSubActivity()
{
Intent intent = new Intent(this, SubActivityClassName.class);
startActivityForResult(intent, REQUEST_CODE); // REQUEST_CODE is >= 0
// Here, I would expect to *not exit* the function *before*
onActivityResult is called (or an activity's lifecycle event triggers)
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (resultCode != Activity.RESULT_CANCELED)
{
// I never get here because the result is always RESULT_CANCELED
Toast.makeText(this, "Blah", Toast.LENGTH_SHORT).show();
}
}
Here's the sub-activity's relevant code (although it's really
irrelevant in this case):
private void handleThisOrThatClick()
{
setResult(RESULT_CODE); // RESULT_CODE is > Activity.RESULT_CANCELED
finish();
}
Am I missing something obvious here?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---