Android Open Source - SpringForAndroidDemo Greeting






From Project

Back to project page SpringForAndroidDemo.

License

The source code is released under:

Apache License

If you think the Android project SpringForAndroidDemo 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.sample.springforandroiddemo;
//from   w w w.j  a  v  a2s . c  om
import java.io.Serializable;
import android.os.Parcel;
import android.os.Parcelable;

public class Greeting implements Parcelable, Serializable{

  // ---------------------------------------------------------------------------
  // Class Constants
  private static final long serialVersionUID = 1L;
  
  // ---------------------------------------------------------------------------
  // Member Variables
  
  private String id;
  private String content;
  
  // ---------------------------------------------------------------------------
  // Constructors
  
  public Greeting(){}
  
  public Greeting(Parcel in){
    id = in.readString();
    content = in.readString();
  }
  
  // ---------------------------------------------------------------------------
  // Getters
  
  public String getId(){
    return this.id;
  }
  
  public String getContent(){
    return this.content;
  }

  // ----------------------------------------------------------------------------
  // Parcelable Class Overrides
  
  @Override
  public int describeContents() {
    return 0;
  }

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

  // ----------------------------------------------------------------------------
  // Parcelable Creator
  
  public final Parcelable.Creator<Greeting> CREATOR = new Parcelable.Creator<Greeting>(){

    @Override
    public Greeting createFromParcel(Parcel source) {
      return new Greeting(source);
    }

    @Override
    public Greeting[] newArray(int size) {
      return new Greeting[size];
    }
    
  };
}




Java Source Code List

com.sample.springforandroiddemo.Greeting.java
com.sample.springforandroiddemo.MainActivity.java