RequestCode changes along the way

139 Views Asked by At

I have a fragment within a fragment

both fragments load fine, except in one of the fragments i have a start camera intent with activity for result

        if (photoFile != null) {
            takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                    Uri.fromFile(photoFile));
            startActivityForResult(takePictureIntent, REQ_TAKE_PHOTO);
        }

now my REQ_TAKE_PHOTO is defined as follows :

public static final int REQ_TAKE_PHOTO=301;

however, in my onActivityResult the request code i get when returning from the camera intent is 131373 -> not the code i sent the request with

what could be changing the code along the way ?

note that when the inner fragment (the one that is incharge of taking the picture) is run separately, the code returns as 301 normally

1

There are 1 best solutions below

0
On BEST ANSWER

to make the requestCode be what it was when i started the startActivityForResult

I need to do requestCode&0xffff

This is apparently a bug in the android support library according to this: https://code.google.com/p/android/issues/detail?id=15394