Why is it possible to write a boolean array to a parcel but not a boolean?

痞子三分冷 提交于 2019-11-30 00:20:34

问题


In the documentation for the Parcel it states a method exists

public final void writeBooleanArray (boolean[] val) 

But there is no method for writeBoolean(boolean val)

There also exists:

public final void writeLong (long val)

public final void writeLongArray (long[] val)

So a similar pattern is available for other primitive types.

Can some one explain why this is?


回答1:


There is an open bug report on it:

http://code.google.com/p/android/issues/detail?id=5973

Evidently others agree with your assessment (and I do too).




回答2:


No reason at all, seems just a miss to me. :-) Write a boolean[1] if you need.

See bug 5973.



来源:https://stackoverflow.com/questions/8171488/why-is-it-possible-to-write-a-boolean-array-to-a-parcel-but-not-a-boolean

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!