标签:esc int and ret tcl abstract bsp static androi
存储Map为作为Bundle在数据,在Intent中传递:
1 /** 2 * Created by naray on 16/7/4. 3 * @abstract map数据序列化 4 */ 5 public class ParcelableMap implements Parcelable 6 { 7 private Map<?, ?> mMap; 8 9 public Map<?, ?> getmMap() 10 { 11 return mMap; 12 } 13 14 public void setmMap(Map<?, ?> mMap) 15 { 16 this.mMap = mMap; 17 } 18 19 @Override 20 public void writeToParcel(Parcel dest, int flags) 21 { 22 dest.writeMap(mMap); 23 } 24 25 @Override 26 public int describeContents() 27 { 28 return 0; 29 } 30 31 public static final Creator<ParcelableMap> CREATOR = new Creator<ParcelableMap>() 32 { 33 @Override 34 public ParcelableMap createFromParcel(Parcel in) 35 { 36 ParcelableMap p = new ParcelableMap(); 37 p.mMap = in.readHashMap(HashMap.class.getClassLoader()); 38 return p; 39 } 40 41 @Override 42 public ParcelableMap[] newArray(int size) 43 { 44 return new ParcelableMap[size]; 45 } 46 }; 47 }
标签:esc int and ret tcl abstract bsp static androi
原文地址:http://www.cnblogs.com/naray/p/5640429.html