Last active
August 29, 2015 14:06
-
-
Save px-amaac/0de82d712d41bd74b6af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Location implements Parcelable{ | |
@Expose | |
private Integer id; | |
@Expose | |
private Coords coords; | |
@Expose | |
private Double distance; | |
public Location(Parcel in) { | |
readFromParcel(in); | |
} | |
@Override public int describeContents() { | |
return 0; | |
} | |
@Override public void writeToParcel(Parcel dest, int flags) { | |
dest.writeValue(id); | |
dest.writeParcelable(coords, flags); | |
dest.writeValue(distance); | |
} | |
public void readFromParcel(Parcel in) { | |
id = (Integer) in.readValue(null); | |
coords = in.readParcelable(Coords.class.getClassLoader()); | |
distance = (Double) in.readValue(null); | |
} | |
public static final Creator<Location> CREATOR = new Creator<Location>() { | |
@Override | |
public Location createFromParcel(Parcel source) { | |
return new Location(source); | |
} | |
@Override | |
public Location[] newArray(int size) { | |
return new Location[size]; | |
} | |
}; | |
public Integer getId() { | |
return id; | |
} | |
public Coords getCoords() { | |
return coords; | |
} | |
public Double getDistance() { | |
return distance; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment