tags:

views:

34

answers:

1

I am putting together a bundle for an activity and sometimes my boolean isLiveis null. When I do the following.

Bundle b = new Bundle();
b.putBoolean("isLive", isLive);

The docs for the SDK clearly say both arguments are allowed to be null, however if isLive is null I get a NullPointerException have I found a bug in the SDK?

+1  A: 

The second parameter to putBoolean is a boolean, not a Boolean. Autounboxing will try to call .booleanValue on the Boolean you're passing in, resulting in the NullPointerException. The documentation is incorrect, and in this case null values will definitely not work since the value parameter type is a primitive.

codelark