Android Open Source - scoreflex-android-sdk J S O N Parcelable






From Project

Back to project page scoreflex-android-sdk.

License

The source code is released under:

Apache License

If you think the Android project scoreflex-android-sdk 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.scoreflex.model;
//from   w  w  w.  j a  va2s  .c  om
import org.json.JSONException;
import org.json.JSONObject;

import android.os.Parcel;
import android.os.Parcelable;
import android.util.Log;

public class JSONParcelable implements Parcelable {

  public static final String TAG = "JSONParcelable";

  protected final JSONObject json;

  public JSONParcelable(Parcel in) throws JSONException {
    this(in.readString());
  }

  public JSONParcelable(String serializedJSON) throws JSONException {
    this(new JSONObject(serializedJSON));
  }

  public JSONParcelable(JSONObject json) {
    this.json = json;
  }

  public JSONParcelable() {
    this.json = new JSONObject();
  }

  @Override
  public int describeContents() {
    return 0;
  }

  @Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(json.toString());
  }

  public JSONObject getJSONObject() { 
    return json;
  }
  
  public static final Parcelable.Creator<JSONParcelable> CREATOR =
      new Parcelable.Creator<JSONParcelable>() {

    public JSONParcelable createFromParcel(Parcel in) {
      try {
        return new JSONParcelable(in);
      } catch (JSONException e) {
        Log.e(TAG, "Error while unserializing JSON from a JSONParcel", e);
        return null;
      }
    }

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

  };

}




Java Source Code List

com.scoreflex.ConnectivityReceiver.java
com.scoreflex.QueryStringParser.java
com.scoreflex.ScoreflexActivity.java
com.scoreflex.ScoreflexBroadcastReceiver.java
com.scoreflex.ScoreflexGcmClient.java
com.scoreflex.ScoreflexJobQueue.java
com.scoreflex.ScoreflexRequestParamsDecorator.java
com.scoreflex.ScoreflexRequestVault.java
com.scoreflex.ScoreflexRestClient.java
com.scoreflex.ScoreflexUriHelper.java
com.scoreflex.ScoreflexView.java
com.scoreflex.Scoreflex.java
com.scoreflex.SocialCallback.java
com.scoreflex.SocialShareCallback.java
com.scoreflex.facebook.ScoreflexFacebookWrapper.java
com.scoreflex.google.ScoreflexGcmWrapper.java
com.scoreflex.google.ScoreflexGoogleWrapper.java
com.scoreflex.model.JSONParcelable.java