Android Open Source - OrderPicker Order






From Project

Back to project page OrderPicker.

License

The source code is released under:

Eclipse Public License (EPL) ---------------------------- THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF T...

If you think the Android project OrderPicker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.liamkeene.orderpicker;
/*from w  w  w . j  a  v  a  2s  . c  o  m*/
import android.os.Parcel;
import android.os.Parcelable;

import org.json.JSONException;
import org.json.JSONObject;

public class Order implements Parcelable {
    private String id;
    private String name;
    private String date;

    Order(String id, String name, String date) {
        // Explicity set the attributes
        this.id = id;
        this.name = name;
        this.date = date;
    }

    Order(JSONObject jsonObject) {
        // Set attributes from JSONObject - no type checking
        try {
            this.id = jsonObject.getString("id");
            this.name = jsonObject.getString("name");
            this.date = jsonObject.getString("date");
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public String getId() { return this.id; }
    public String getName() { return this.name; }
    public String getDate() { return this.date; }

    public String toString() {
        return "Order " + this.id;
    }

    @Override
    public int describeContents() {
        // Describe special contents
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        // Flatten the attributes that we require to a Parcel
        dest.writeString(id);
        dest.writeString(name);
        dest.writeString(date);
    }

    public static final Parcelable.Creator<Order> CREATOR
            = new Parcelable.Creator<Order>() {
        // Creator that generates instances of Orders from a parcel
        public Order createFromParcel(Parcel in) {
            return new Order(in);
        }

        public Order[] newArray(int size) {
            return new Order[size];
        }
    };

    private Order(Parcel in) {
        // Constructor to create an Order from a Parcel
        // Attributes are read in the order they were written to the Parcel
        id = in.readString();
        name = in.readString();
        date = in.readString();
    }
}




Java Source Code List

com.liamkeene.orderpicker.OrderDetailActivity.java
com.liamkeene.orderpicker.OrderDetailFragment.java
com.liamkeene.orderpicker.OrderListActivity.java
com.liamkeene.orderpicker.OrderListFragment.java
com.liamkeene.orderpicker.Order.java