On Mon, Nov 28, 2011 at 12:17 AM, Carlos A. M. dos Santos
<[email protected]> wrote:
> Hello,
>
> I have the following code in class MyActivity:
>
>    public static final int REQ_CODE = 0x7fffffff;
> ...
>                    startActivityForResult(intent, REQ_CODE);
> ...
>    @Override
>    public void onActivityResult(int requestCode, int resultCode, Intent data) 
> {
>        Log.d(TAG, "#### onActivityResult: " +
> Integer.toHexString(requestCode));
>        switch (requestCode) {
>            case 0:
>            case REQ_CODE:
>                Log.d(TAG, "#### REQ_CODE ####");
>                break;
>            default:
>                Log.d(TAG, "#### Equals: " + (requestCode == REQ_CODE));
>        }
>    }
>
> When I run it I get the following log messages:
>
> D/MyActivity(11505): #### onActivityResult: 7fffffff
> D/MyActivity(11505): #### REQ_CODE ####
>
> Now for the mystery. If I comment-out the "case 0" clause I get these
> log messages:
>
> D/MyActivity(11471): #### onActivityResult: 7fffffff
> D/MyActivity(11471): #### Equals: true
>
> If I comment-out the "case 0" clause and change the value of REQ_CODE
> to 0x7ffffffe I get a correct result again. To make the case even more
> mysterious, a similar code works perfectly well in another class,
> inside a method overriding Handler.handleMessage(Message msg).
>
> My environment:
>
> - Ubuntu 11.10 x86 (32bit).
> - Android SDK Tools r15
> - ADT Version: 15.0.1.v201111031820-219398
> - javac 1.6.0_26
> - Project target API: 7 (Android 2.1)
>
> Additional information:
>
> - Building with ant does not make any difference.
> - Changing Java compliance to 1.5 does not make any difference.
> - The problem can reproduced 100% of the times, both on Nexus S with
> Android 2.6.3 and on emulator running Android 2.1.
> - No, I'm not drunk!

Extra additional information: the problem also happens when I build on
another machine, with SDK Tools r12 and Platform-tools r6.

Can anybody help me to debug this? I'm whiling to fill a bug report,
but I need additional information. I suspect that the problem is
caused by the conversion to DEX code.

-- 
"The flames are all long gone, but the pain lingers on"

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