Android通过AIDL实现下载进程通信
2012-11-08 19:04:01 来源:WEB开发网@Override
public Queue createFromParcel(Parcel source) {
return new Queue(source);
}
@Override
public Queue[] newArray(int size) {
return new Queue[size];
}
};
public Queue() {
}
private Queue(Parcel source){
readFromParcel(source);
}
public void readFromParcel(Parcel source) {
id = source.readInt();
name = source.readString();
url = source.readString();
savePath = source.readString();
downingIntent = source.readString();
completeIntent = source.readString();
fileLength = source.readLong();
downSize = source.readLong();
boolean[] b = new boolean[2];
source.readBooleanArray(b);
if(b.length > 0){
cancel = b[0];
autoRun = b[1];
}
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flag) {
dest.writeInt(id);
dest.writeString(name);
dest.writeString(url);
dest.writeString(savePath);
dest.writeString(downingIntent);
dest.writeString(completeIntent);
dest.writeLong(fileLength);
dest.writeLong(downSize);
boolean[] b = {cancel,autoRun};
dest.writeBooleanArray(b);
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSavePath() {
return savePath;
}
public void setSavePath(String savePath) {
this.savePath = savePath;
}
public String getDowningIntent() {
return downingIntent;
}
public void setDowningIntent(String downingIntent) {
this.downingIntent = downingIntent;
}
public String getCompleteIntent() {
return completeIntent;
}
public void setCompleteIntent(String completeIntent) {
this.completeIntent = completeIntent;
}
public long getFileLength() {
return fileLength;
}
public void setFileLength(long fileLength) {
this.fileLength = fileLength;
}
public long getDownSize() {
return downSize;
}
public void setDownSize(long downSize) {
this.downSize = downSize;
}
public boolean isCancel() {
return cancel;
}
public void setCancel(boolean cancel) {
this.cancel = cancel;
}
public boolean isAutoRun() {
return autoRun;
}
public void setAutoRun(boolean autoRun) {
this.autoRun = autoRun;
}
}
android 下载队列类 Queue.java对应的aidl实现
该aidl文件用于进程间通信时序列化Queue类,很简单就几句话
package com.obatu.services.aidl;
import com.obatu.services.aidl.Queue;
parcelable Queue;
android
更多精彩
赞助商链接