Created
September 20, 2016 03:20
-
-
Save lucas-marciano/fde17f182271f4c1b001f3dfa3d706c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.os.Parcel; | |
| import android.os.Parcelable; | |
| public class Cliente implements Parcelable { | |
| private int codigo; | |
| private String nome; | |
| public Cliente(int codigo, String nome) { | |
| this.codigo = codigo; | |
| this.nome = nome; | |
| } | |
| private Cliente(Parcel p){ | |
| codigo = from.readInt(); | |
| nome = from.readString(); | |
| } | |
| public static final Parcelable.Creator<Cliente> | |
| CREATOR = new Parcelable.Creator<Cliente>() { | |
| public Cliente createFromParcel(Parcel in) { | |
| return new Cliente(in); | |
| } | |
| public Cliente[] newArray(int size) { | |
| return new Cliente[size]; | |
| } | |
| }; | |
| public int getCodigo() { | |
| return codigo; | |
| } | |
| public void setCodigo(int codigo) { | |
| this.codigo = codigo; | |
| } | |
| public String getNome() { | |
| return nome; | |
| } | |
| public void setNome(String nome) { | |
| this.nome = nome; | |
| } | |
| @Override | |
| public int describeContents() { | |
| return 0; | |
| } | |
| @Override | |
| public void writeToParcel(Parcel dest, int flags) { | |
| dest.writeInt(codigo); | |
| dest.writeString(nome); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment