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

From Project

Back to project page scoreflex-android-sdk.


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 {

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

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

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

  public int describeContents() {
    return 0;

  public void writeToParcel(Parcel dest, int flags) {

  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