本文整理汇总了Java中android.os.Parcel类的典型用法代码示例。如果您正苦于以下问题:Java Parcel类的具体用法?Java Parcel怎么用?Java Parcel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Parcel类属于android.os包,在下文中一共展示了Parcel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeToParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeValue(this.iD);
dest.writeString(this.name);
dest.writeValue(this.packageBaseID);
dest.writeString(this.packageBase);
dest.writeString(this.version);
dest.writeString(this.description);
dest.writeString(this.uRL);
dest.writeValue(this.numVotes);
dest.writeValue(this.popularity);
dest.writeString(this.outOfDate);
dest.writeString(this.maintainer);
dest.writeValue(this.firstSubmitted);
dest.writeValue(this.lastModified);
dest.writeString(this.uRLPath);
dest.writeStringList(this.depends);
dest.writeStringList(this.makeDepends);
dest.writeStringList(this.optDepends);
dest.writeStringList(this.conflicts);
dest.writeStringList(this.provides);
dest.writeStringList(this.license);
dest.writeStringList(this.keywords);
}
示例2: LoginClient
import android.os.Parcel; //导入依赖的package包/类
public LoginClient(Parcel source) {
Object [] o = source.readParcelableArray(LoginMethodHandler.class.getClassLoader());
handlersToTry = new LoginMethodHandler[o.length];
for (int i = 0; i < o.length; ++i) {
handlersToTry[i] = (LoginMethodHandler) o[i];
handlersToTry[i].setLoginClient(this);
}
currentHandler = source.readInt();
pendingRequest = source.readParcelable(Request.class.getClassLoader());
loggingExtras = Utility.readStringMapFromParcel(source);
}
示例3: writeToParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(this.id);
dest.writeString(this.url);
dest.writeInt(this.total_count);
dest.writeInt(this.plusOne);
dest.writeInt(this.minusOne);
dest.writeInt(this.laugh);
dest.writeInt(this.hooray);
dest.writeInt(this.confused);
dest.writeInt(this.heart);
dest.writeString(this.content);
dest.writeParcelable(this.user, flags);
dest.writeByte(this.viewerHasReacted ? (byte) 1 : (byte) 0);
dest.writeByte(this.isCallingApi ? (byte) 1 : (byte) 0);
}
示例4: testVoterParcelMale
import android.os.Parcel; //导入依赖的package包/类
@Test
public void testVoterParcelMale() {
Voter voter = new Voter(firstName, lastName, Gender.MALE);
Parcel parcel = Parcel.obtain();
voter.writeToParcel(parcel, 0);
// After you're done with writing, you need to reset the parcel for reading:
parcel.setDataPosition(0);
// Reconstruct object from parcel and asserts:
Voter createdFromParcel = Voter.CREATOR.createFromParcel(parcel);
assertEquals(voter.getFirstName(), createdFromParcel.getFirstName());
assertEquals(voter.getLastName(), createdFromParcel.getLastName());
assertEquals(voter.getGender(), createdFromParcel.getGender());
}
示例5: readIntStringMap
import android.os.Parcel; //导入依赖的package包/类
public static Map<Integer, String> readIntStringMap(Parcel in){
boolean isNull = in.readByte() == (byte) 1;
if(isNull){
return null;
}
int size = in.readInt();
Map<Integer, String> map = new HashMap<>(size);
for(int i = 0; i < size; i++){
Integer key = readObjectInteger(in);
String value = in.readString();
map.put(key, value);
}
return map;
}
示例6: createFromParcel
import android.os.Parcel; //导入依赖的package包/类
@SuppressWarnings({
"unchecked"
})
public List createFromParcel(Parcel in) {
List instance = new List();
instance.dt = ((int) in.readValue((int.class.getClassLoader())));
instance.temp = ((Temp) in.readValue((Temp.class.getClassLoader())));
instance.pressure = ((double) in.readValue((double.class.getClassLoader())));
instance.humidity = ((int) in.readValue((int.class.getClassLoader())));
in.readList(instance.weather, (Weather.class.getClassLoader()));
instance.speed = ((double) in.readValue((double.class.getClassLoader())));
instance.deg = ((int) in.readValue((int.class.getClassLoader())));
instance.clouds = ((int) in.readValue((int.class.getClassLoader())));
instance.rain = ((double) in.readValue((double.class.getClassLoader())));
return instance;
}
示例7: writeToParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeLong(id);
dest.writeString(mimeType);
dest.writeParcelable(uri, 0);
dest.writeLong(size);
dest.writeLong(duration);
}
示例8: createFromParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public AlbumItem createFromParcel(Parcel parcel) {
switch (parcel.readInt()) {
case VIDEO:
return new Video(parcel);
case GIF:
return new Gif(parcel);
case RAW:
return new RAWImage(parcel);
default:
return new Photo(parcel);
}
}
示例9: isReadyRemote
import android.os.Parcel; //导入依赖的package包/类
/**
* 检查所有的服务是否已经就位(已经添加到{@link ServiceManagerThread})
* @return
*/
private boolean isReadyRemote(){
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
try {
mRemoteServiceManager.transact(ServiceContext.READY_REMOTE, data, reply, 0);
int result = reply.readInt();
if(result == ServiceContext.SUCCESS) {
log("remote service manager ready");
return true;
}
log("remote service manager not ready");
return false;
} catch (RemoteException e) {
e.printStackTrace();
log("getService exception");
return false;
} finally {
data.recycle();
reply.recycle();
}
}
示例10: DataBean
import android.os.Parcel; //导入依赖的package包/类
protected DataBean(Parcel in)
{
this.roomStatus = in.readInt();
this.liveStatus = in.readInt();
this.url = in.readString();
this.title = in.readString();
this.cover = in.readString();
this.online = in.readInt();
this.roomid = in.readInt();
}
示例11: writeToParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.key);
dest.writeString(this.value);
dest.writeString(this.oldValue);
dest.writeInt(this.selectionStart);
dest.writeInt(this.selectionEnd);
dest.writeByte(this.isFoucused ? (byte) 1 : (byte) 0);
}
示例12: SavedState
import android.os.Parcel; //导入依赖的package包/类
/**
* Called from {@link #CREATOR} to create an instance of SavedState form the given parcel
* <var>source</var>.
*
* @param source Parcel with data for the new instance.
*/
protected SavedState(@NonNull Parcel source) {
super(source);
this.dateVisible = source.readLong();
this.dateSelected = (Long) source.readValue(Long.class.getClassLoader());
this.selectedDayMonthPosition = source.readInt();
this.locale = (Locale) source.readSerializable();
this.adapterState = source.readParcelable(UiConfig.class.getClassLoader());
}
示例13: readFromParcel
import android.os.Parcel; //导入依赖的package包/类
private void readFromParcel(Parcel in) {
if (in.readInt() == 1) {
mDevice = BluetoothLeDevice.CREATOR.createFromParcel(in);
}
if (in.readInt() == 1) {
mScanRecord = ScanRecordCompat.parseFromBytes(in.createByteArray());
}
mRssi = in.readInt();
mTimestampNanos = in.readLong();
}
示例14: writeToParcel
import android.os.Parcel; //导入依赖的package包/类
@Override
public void writeToParcel(Parcel parcel, int i) {
parcel.writeString(id);
parcel.writeString(name);
parcel.writeString(description);
parcel.writeString(status.name());
parcel.writeLong(publishedAt != null ? publishedAt.getTime() : -1L);
parcel.writeInt(enabledCount);
parcel.writeLong(lastRunAt != null ? lastRunAt.getTime() : -1L);
parcel.writeString(url);
parcel.writeString(embeddedUrl);
parcel.writeTypedList(services);
}
示例15: WheelSavedState
import android.os.Parcel; //导入依赖的package包/类
private WheelSavedState(Parcel in) {
super(in);
this.mProgress = in.readFloat();
this.mTargetProgress = in.readFloat();
this.isSpinning = in.readByte() != 0;
this.spinSpeed = in.readFloat();
this.barWidth = in.readInt();
this.barColor = in.readInt();
this.rimWidth = in.readInt();
this.rimColor = in.readInt();
this.circleRadius = in.readInt();
this.linearProgress = in.readByte() != 0;
this.fillRadius = in.readByte() != 0;
}