On Mon, Nov 28, 2011 at 10:53 PM, Mark Murphy <mmur...@commonsware.com> wrote:
> Well, I can reproduce your behavior. It's not tied to
> onActivityResult() -- any switch statement has the effect:
>
> public class MyApp extends Activity {
>   static final int RC_OTHER=0x7fffffff;
>
>   @Override
>   public void onCreate(Bundle savedInstanceState) {
>     super.onCreate(savedInstanceState);
>
>     int i=RC_OTHER;
>
>     switch (i) {
>       case RC_OTHER:
>         Log.d("MyApp", "a");
>         break;
>
>       default:
>         Log.d("MyApp", "b");
>         break;
>     }
>
>     finish();
>   }
> }
>
> That dumps "b" where it should show "a", and does show "a" for every
> other RC_OTHER value I've tried.
>
> It works when the switch() is converted to an if().
>
> It works if, using the same Java compiler, I try the same case
> statement, dumping to System.out. So, it's not a javac bytecode
> generation error -- it's in Dalvik somewhere (tools or VM).
>
> So, it would appear to be a real bug. I have filed an issue:
>
> http://code.google.com/p/android/issues/detail?id=22344
>
> The workaround is to pick any other value, or use if().
>
> Thanks for pointing this out!

To whom it may concern: a fix was finally merged to the source tree so
it will hopefully be available on Android 4.2. Given the speed at
which vendors provide OS upgrades (ha ha ha!) I predict that it will
be possible to use 0x7fffffff in a switch clause on Android by the end
of 2015. Go, Android!

Reference: https://android-review.googlesource.com/#/c/44733/

-- 
"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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to