I am sure it will be fixed in whatever the next version of Android is and if they back port the fix and the phones get updated (likelihood: 0.0001%).
So unless you are targeting ONLY the non-yet public next version of the SDK, you might as well just not even assume this fix exists and code around it somehow. On Thursday, April 26, 2012 9:24:59 AM UTC+8, Casvah wrote: > > Has this issue been fixed? The bug report on the issue tracker says it's > closed, but there are new comments from people having this issue. I am also > having this issue. I might be doing it wrong though, since I can't get it > to work with any request code. > > On Thursday, March 10, 2011 12:15:12 PM UTC-6, Dianne Hackborn wrote: >> >> Whoops, yeah that is a bug. Thanks for finding it. I'll fix it in the >> next update. >> >> On Thu, Mar 10, 2011 at 1:55 AM, Pete Doyle wrote: >> >>> Ran into this issue tonight on my Droid (2.2). I think there's an issue >>> in FragmentActivity.startActivityFromFragment(...). >>> >>> YMMV, but this seems to fix it for me: >>> >>> https://github.com/petedoyle/android-support-v4-googlemaps/commit/06307de35a9de0a89ff52bb42a358ba6740e542c >>> >>> Basically there are two issues: >>> 1) "(fragment.mIndex+1)<<16" should be in parentheses since + has >>> precedence over << in Java >>> 2) requestCode*0xffff should be requestCode&0xffff. (I think the goal >>> is to strip all but the first 16 bits of the request code). >>> >>> To understand the fix, assume you have a fragment index of 0 and a >>> requestCode of 1. >>> >>> With the current code: >>> (fragment.mIndex+1)<<16 + (requestCode*0xffff) >>> = (0+1)<<16 + (1*0xFFFF) >>> = (1)<< (16 + 0xFFFF) // since + has precedence over << >>> = 1<<65551 >>> = 32768 // according to my debugger >>> = 1000 0000 0000 0000 // fragment index is lost, request code changes >>> from 1 to 32768 >>> >>> With this change: >>> ((fragment.mIndex+1)<<16) + (requestCode&0xffff) >>> = ((0+1)<<16) + (1&0xFFFF) >>> = (1<<16) + 1 >>> = 65536 + 1 >>> = 65537 >>> = 1 0000 0000 0000 0001 >>> >>> Thanks, >>> Pete >>> >>> On Wed, Mar 9, 2011 at 9:20 AM, Dianne Hackborn <[email protected]>wrote: >>> >>>> Does the API demo for this work wherever you are running it? I have >>>> tested it on 3.0, 2.3, and 1.6, and it works in those places, not would I >>>> expect it to have any trouble elsewhere. (How this works is very simple, >>>> it just masks out the top X bits of the request code to determine which >>>> fragment to deliver the result to.) >>>> >>>> Also of course if you are overriding >>>> FragmentActivity.onActivityResult(), you *do* need to be sure to call the >>>> inherited version. The behavior here is slightly different than the HC >>>> implementation; the activity method will always be called first. >>>> >>>> >>>> On Wed, Mar 9, 2011 at 8:14 AM, drasticp <[email protected]> wrote: >>>> >>>>> 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 >>>>> >>>> >>>> >>>> >>>> -- >>>> Dianne Hackborn >>>> Android framework engineer >>>> [email protected] >>>> >>>> Note: please don't send private questions to me, as I don't have time >>>> to provide private support, and so won't reply to such e-mails. All such >>>> questions should be posted on public forums, where I and others can see >>>> and >>>> answer them. >>>> >>>> -- >>>> 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 >>>> >>> >>> -- >>> 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 >>> >> >> >> >> -- >> Dianne Hackborn >> Android framework engineer >> [email protected] >> >> Note: please don't send private questions to me, as I don't have time to >> provide private support, and so won't reply to such e-mails. All such >> questions should be posted on public forums, where I and others can see and >> answer them. >> >> -- 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

