博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Android对象类系列化public class User implements Parcelable
阅读量:6864 次
发布时间:2019-06-26

本文共 1337 字,大约阅读时间需要 4 分钟。

1 package com.gaojinhua.android.activitymsg; 2  3 import android.os.Parcel; 4 import android.os.Parcelable; 5  6 /** 7  * Created by Gaojinhua on 2015/8/14. 8  */ 9 public class User implements Parcelable {10     private String name;11     private int age;12 13     public User(String name, int age) {14         this.name = name;15         this.age = age;16     }17 18 19     public void setName(String name) {20         this.name = name;21     }22 23     public String getName() {24         return name;25     }26 27     public void setAge(int age) {28         this.age = age;29     }30 31     public int getAge() {32         return age;33     }34 35     @Override36     public int describeContents() {37         return 0;38     }39 40     @Override41     public void writeToParcel(Parcel dest, int flags) {42         dest.writeString(getName());43         dest.writeInt(getAge());44     }45 46     public static final Creator
CREATOR = new Creator
() {47 @Override48 public User createFromParcel(Parcel source) {49 return new User(source.readString(), source.readInt());50 }51 52 @Override53 public User[] newArray(int size) {54 return new User[size];55 }56 };57 58 59 }

 

转载于:https://www.cnblogs.com/gaojinhua/p/4731456.html

你可能感兴趣的文章
006.递归和分治思想
查看>>
FTP服务器端程序分类
查看>>
CSS布局之品字布局
查看>>
LINUX学习笔记高度浓缩版之一 :用户管理、启动过程、硬盘管理
查看>>
JavaScript创建对象的方法
查看>>
『ExtJS』01 009. ExtJS 4 方法重载
查看>>
org.springframework.data.mapping.PropertyReferenceException: No property xxxx found for type Xxxx
查看>>
我的友情链接
查看>>
我的友情链接
查看>>
AIX查看端口被占用
查看>>
GUN sed高级用法,sed脚本编写
查看>>
我的友情链接
查看>>
HTML 5 Web Workers
查看>>
基于koajs的web项目构建-心得篇
查看>>
通过minify将项目中js和css文件的打包
查看>>
提取Windows用户密钥文件cachedump
查看>>
自定义grains_module pillar
查看>>
log file sycn 概述
查看>>
Javascript对于不同浏览器的兼容性
查看>>
开源在线阅读技术资源
查看>>