title: Parcel Bitmap - Android
body: <p>In the existing code I have following class to hold category details.</p>
  
  <pre><code>import org.json.JSONObject;
  import android.graphics.Bitmap;
  import android.os.Parcel;
  import android.os.Parcelable;
  
  public class Category  {
  
  
  private String mIconURL;
  private String mName;
  
  
  
  public Category() {
      super();
  }
  
  public String getIconURL() {
      return mIconURL;
  }
  
  
  public void setIconURL(String iconURL) {
      this.mIconURL = iconURL;
  }
  
  public String getName() {
      return mName;
  }
  
  public void setName(String name) {
      this.mName = name;
  }
  
  @Override
  public void writeToParcel(Parcel dest, int flags) {
      super.writeToParcel(dest, flags);
  
      dest.writeString(mIconURL);
      dest.writeString(mName);
  
  
  }
  
  public static final Parcelable.Creator&lt;Category&gt; CREATOR = new Parcelable.Creator&lt;Category&gt;() {
  
      public Category createFromParcel(Parcel in) {
          return new Category(in);
      }
  
      public Category[] newArray(int size) {
          return new Category[size];
      }
  };
  
  private Category(Parcel in) {
      super(in);
      mIconURL = in.readString();
      mName = in.readString();
  
  
  }
  
  @Override
  public int describeContents() {
  
      return 1;
  }
  
  @Override
  public String toString() {
      StringBuilder builder = new StringBuilder();
      builder.append("{");
      builder.append(super.toString());
      builder.append(", mName=").append(mName);
      builder.append(", mIconURL=").append(mIconURL);
      builder.append("}");
      return builder.toString();
  }
  
  public static Category parseFromJSON(JSONObject jsonObject) {
      Category cat = new Category();
      try {
          cat.setServerId(jsonObject.getInt("id"));
          cat.setName(jsonObject.getString("name"));
          cat.setIconURL(jsonObject.getString("icon"));
  
      } catch (Exception e) {
  
      }
      return cat;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And application works fine, but now I want to add Image property to this category class. I am new to Java and Android. But existing class has something called parcel. Now how i do same for bitmap? Is it like below</p>
  
  <pre><code>public Bitmap getImage()
  {
      return mImage;
  }
  
  
  @Override
  public void writeToParcel(Parcel dest, int flags) {
      super.writeToParcel(dest, flags);
  
      dest.writeString(mIconURL);
      dest.writeString(mName);
      dest.writeByteArray(mImage);// there is no "writeBitmap" method in Parcel.
  
  }
  </code></pre>
  
  <p>Please guide me</p>