private Car(Parcel in){ door = new Integer[MAX_DOORS]; for(int i = 0; i < MAX_DOORS; i++) door[i] = in.readInt(); tank = in.readInt(); temp = in.readDouble(); try { start = new JSONObject(in.readString()); route = new JSONArray(in.readString()); history = new JSONArray((in.readString())); } catch (JSONException e) {e.printStackTrace();} } @Override public void writeToParcel(Parcel dest, int flags) { for(int i = 0; i < MAX_DOORS; i++) dest.writeInt(door[i]); dest.writeInt(tank); dest.writeDouble(temp); dest.writeString(start.toString()); dest.writeString(route.toString()); dest.writeString(history.toString()); } public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public Car createFromParcel(Parcel in) { return new Car(in); } public Car[] newArray(int size) { return new Car[size]; } };