I have an application that targets 2.1. I'm using the Android
Compatibility Package to migrate the code in my Activities to
Fragments. I had an Activity which was launching a contact picker as
follows:

Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);

The result was appropriately handled in the onActivityResult for the
Activity:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent
data) {
        if (resultCode != Activity.RESULT_OK) return;
    switch (requestCode) {
    case CONTACT_PICKER_RESULT:
        handleResult(data);
        break;
    }
}

Now, I've migrated both the startActivityForResult call and the
onActivityResult into a Fragment. I have also extended
FragmentActivity in the hosting Activity.

The contact picker still launches correctly, but onActivityResult in
the fragment is never called. If I override onActivityResult in the
FragmentActivity, it *IS* called. However, I don't want to handle the
result there because it breaks the encapsulation philosophy of the new
fragments.

Shouldn't onActivityResult in the fragment be called? Am I missing
something? Thanks for your assistance!

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