Commit 2ddc4ae6 by 罗翻

测试aidl

parent a2566532
// IRomteService.aidl
package com.dayu.bigfish;
// Declare any non-default types here with import statements
import com.dayu.bigfish.api.protocol.Book;
interface IRomteService {
/**
* 获取图书列表
*/
List<Book> getBookList();
/**
* 添加图书
*/
void addBook(in Book book);
String add();
}
// Person.aidl
package com.dayu.bigfish.api.protocol;
// Declare any non-default types here with import statements
parcelable Book;
package com.dayu.bigfish.api.protocol;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by znh on 2018/6/10.
* <p>
* 封装图书信息的Book类
*/
public class Book implements Parcelable {
//图书ID
public int bookId;
//图书名称
public String bookName;
public Book(int bookId, String bookName) {
this.bookId = bookId;
this.bookName = bookName;
}
private Book(Parcel source) {
bookId = source.readInt();
bookName = source.readString();
}
public static final Creator<Book> CREATOR = new Creator<Book>() {
@Override
public Book createFromParcel(Parcel in) {
return new Book(in);
}
@Override
public Book[] newArray(int size) {
return new Book[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(bookId);
dest.writeString(bookName);
}
@Override
public String toString() {
return "Book{" +
"bookId=" + bookId +
", bookName='" + bookName + '\'' +
'}';
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment