Reputation: 31493
I am putting together a bundle for an activity and sometimes my boolean
isLive
is 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?
Upvotes: 1
Views: 1405
Reputation: 12334
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.
Upvotes: 2