android arcelable 传递 boolean值

来源:互联网 发布:4g网络优化初级工程师 编辑:程序博客网 时间:2024/06/07 12:45

http://stackoverflow.com/questions/6201311/how-to-read-write-a-boolean-when-implementing-the-parcelable-interface?answertab=votes#tab-top



Here's how I'd do it...writeToParcel:dest.writeByte((byte) (myBoolean ? 1 : 0));     //if myBoolean == true, byte == 1readFromParcel:myBoolean = in.readByte() != 0;     //myBoolean == true if byte != 0


0 0
原创粉丝点击