// Path: AIDLDemo/AIDLService/app/src/main/aidl/com/arialyy/aidldemo/Product.java
// public class Product implements Parcelable {
//   public String name;
//   public int price;
// 
//   @Override public String toString() {
//     return "Product{" + "name='" + name + '\'' + ", price=" + price + '}';
//   }
// 
//   @Override public int describeContents() {
//     return 0;
//   }
// 
//   @Override public void writeToParcel(Parcel dest, int flags) {
//     dest.writeString(this.name);
//     dest.writeInt(this.price);
//   }
// 
//   //手动实现这个方法
//   public void readFromParcel(Parcel dest) {
//     //注意，这里的读取顺序要writeToParcel()方法中的写入顺序一样
//     name = dest.readString();
//     price = dest.readInt();
//   }
// 
//   public Product() {
//   }
// 
//   protected Product(Parcel in) {
//     this.name = in.readString();
//     this.price = in.readInt();
//   }
// 
//   public static final Parcelable.Creator<Product> CREATOR = new Parcelable.Creator<Product>() {
//     @Override public Product createFromParcel(Parcel source) {
//       return new Product(source);
//     }
// 
//     @Override public Product[] newArray(int size) {
//       return new Product[size];
//     }
//   };
// }


import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.arialyy.aidldemo.Product;
import com.arialyy.aidldemo.LoadMessageInterface;
package com.arialyy.aidlclient;


public class MainActivity extends AppCompatActivity {
  private static final String TAG = "MainActivity";
  LoadMessageInterface messageInterface = null;

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

  }


  public void onClick(View view){
    ServiceConnection serviceConnection = new ServiceConnection() {
      @Override public void onServiceConnected(ComponentName name, IBinder service) {
        //获取到服务器传过来的对象
        messageInterface = LoadMessageInterface.Stub.asInterface(service);
        try {
          messageInterface.loadMessage("123");
// Path: AIDLDemo/AIDLService/app/src/main/aidl/com/arialyy/aidldemo/Product.java
// public class Product implements Parcelable {
//   public String name;
//   public int price;
// 
//   @Override public String toString() {
//     return "Product{" + "name='" + name + '\'' + ", price=" + price + '}';
//   }
// 
//   @Override public int describeContents() {
//     return 0;
//   }
// 
//   @Override public void writeToParcel(Parcel dest, int flags) {
//     dest.writeString(this.name);
//     dest.writeInt(this.price);
//   }
// 
//   //手动实现这个方法
//   public void readFromParcel(Parcel dest) {
//     //注意，这里的读取顺序要writeToParcel()方法中的写入顺序一样
//     name = dest.readString();
//     price = dest.readInt();
//   }
// 
//   public Product() {
//   }
// 
//   protected Product(Parcel in) {
//     this.name = in.readString();
//     this.price = in.readInt();
//   }
// 
//   public static final Parcelable.Creator<Product> CREATOR = new Parcelable.Creator<Product>() {
//     @Override public Product createFromParcel(Parcel source) {
//       return new Product(source);
//     }
// 
//     @Override public Product[] newArray(int size) {
//       return new Product[size];
//     }
//   };
// }


// Path: AIDLDemo/AIDLClient/app/src/main/java/com/arialyy/aidlclient/MainActivity.java
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import com.arialyy.aidldemo.Product;
import com.arialyy.aidldemo.LoadMessageInterface;

package com.arialyy.aidlclient;


public class MainActivity extends AppCompatActivity {
  private static final String TAG = "MainActivity";
  LoadMessageInterface messageInterface = null;

  @Override protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

  }


  public void onClick(View view){
    ServiceConnection serviceConnection = new ServiceConnection() {
      @Override public void onServiceConnected(ComponentName name, IBinder service) {
        //获取到服务器传过来的对象
        messageInterface = LoadMessageInterface.Stub.asInterface(service);
        try {
          messageInterface.loadMessage("123");
          Product p = new Product();