首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

Intent传送复杂对象时Parcelable用法学习

2012-06-28 
Intent传递复杂对象时Parcelable用法学习Parcelable传递对象http://www.apkbus.com/android-19356-1-1.htm

Intent传递复杂对象时Parcelable用法学习
Parcelable传递对象
http://www.apkbus.com/android-19356-1-1.html
Parcelable对象

import android.os.Parcel;import android.os.Parcelable;public class Person implements Parcelable{    private String Name = "anupama";    private String Address = "India";    private int Age = 30;        @Override    public int describeContents()    {        // TODO Auto-generated method stub        return 0;    }    @Override    public void writeToParcel(Parcel dest, int flag)    {        // TODO Auto-generated method stub        dest.writeString(Name);        dest.writeString(Address);        dest.writeInt(Age);    }    public Person(Parcel in)    {        this.Name = in.readString();        this.Address = in.readString();        this.Age = in.readInt();    }    @SuppressWarnings("unchecked")    public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {        public Person createFromParcel(Parcel in)        {            return new Person(in);        }        public Person[] newArray(int size)        {            return new Person;        }    };}


http://blog.163.com/eden_dahua/blog/static/18549828320114311210519/
http://blog.sina.com.cn/s/blog_4cdc44df0100xofl.html
http://hi.baidu.com/tyliang/blog/item/b42f2986e4128f36c75cc358.html

热点排行