zoukankan      html  css  js  c++  java
  • 实体类实现Parcelable(包含boolean类型)

    实体类实现Parcelable接口需要实现方法:

    public ExtSignClockEntity(Parcel in) {
    timeMess = in.readString();
    repeatMess = in.readString();
    label = in.readString();
    ring = in.readString();
    isRemind = in.readByte() != 0;
    }
    public static final Creator<ExtSignClockEntity> CREATOR = new Creator<ExtSignClockEntity>() {
    @Override
    public ExtSignClockEntity createFromParcel(Parcel in) {
    return new ExtSignClockEntity(in);
    }

    @Override
    public ExtSignClockEntity[] newArray(int size) {
    return new ExtSignClockEntity[size];
    }
    };
     @Override
    public int describeContents() {
    return 0;
    } @Override
    public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(timeMess);
    dest.writeString(repeatMess);
    dest.writeString(label);
    dest.writeString(ring);
    dest.writeByte((byte)(isRemind?1:0));
    }
    其中boolean类型的数据输入输出分别为:boolean isCheck; Pacel parcel;
    输入: parcel.readByte()!= 0;
    输出: isCheck=parcel..writeByte((byte)(isCheck?1:0));
  • 相关阅读:
    c# 门禁随笔
    DataTable到Access
    C#文件上传
    C#操作文件
    JavaScript 全局封装
    jsavascript 目录的操作(摘抄)
    12-STM32 ADC原理
    11-STM32 高级定时器TIM1/8
    10-STM32 基本定时器TIM
    9-STM32 WWDG窗口看门狗
  • 原文地址:https://www.cnblogs.com/zhy7104/p/5804268.html
Copyright © 2011-2022 走看看