Code example for Parcel

Methods: writeDoublewriteFloatwriteLongwriteString

0
	/***********************************/ 
	/*        PARCELABLE PART          */ 
	/***********************************/ 
	 
	public static void writeLocation(Parcel dest, Location loc) {
		dest.writeString(loc.getProvider());
		dest.writeLong(loc.getTime());
		dest.writeDouble(loc.getLatitude());
		dest.writeDouble(loc.getLongitude());
		dest.writeDouble(loc.getAltitude());
		dest.writeFloat(loc.getAccuracy());
		dest.writeFloat(loc.getBearing());
		dest.writeFloat(loc.getSpeed());
	} 
	 
	public static Location readLocation(Parcel in) {
		Location loc = new Location(in.readString());
		loc.setTime(in.readLong());
		loc.setLatitude(in.readDouble());
		loc.setLongitude(in.readDouble());
Experience pair programming with AI  Get Codota for Java