本文整理了Java中android.os.Parcel.readParcelable()
方法的一些代码示例,展示了Parcel.readParcelable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.readParcelable()
方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:readParcelable
[英]Read and return a new Parcelable from the parcel. The given class loader will be used to load any enclosed Parcelables. If it is null, the default class loader will be used.
[中]阅读并返回包裹中的新包裹。给定的类装入器将用于装入任何封闭的包裹。如果为空,将使用默认的类装入器。
代码示例来源:origin: google/ExoPlayer
/* package */ Metadata(Parcel in) {
entries = new Metadata.Entry[in.readInt()];
for (int i = 0; i < entries.length; i++) {
entries[i] = in.readParcelable(Entry.class.getClassLoader());
}
}
代码示例来源:origin: google/ExoPlayer
/* package */ TrackGroupArray(Parcel in) {
length = in.readInt();
trackGroups = new TrackGroup[length];
for (int i = 0; i < length; i++) {
trackGroups[i] = in.readParcelable(TrackGroup.class.getClassLoader());
}
}
代码示例来源:origin: google/ExoPlayer
/* package */ TrackGroup(Parcel in) {
length = in.readInt();
formats = new Format[length];
for (int i = 0; i < length; i++) {
formats[i] = in.readParcelable(Format.class.getClassLoader());
}
}
代码示例来源:origin: android-hacker/VirtualXposed
protected AppTaskInfo(Parcel in) {
taskId = in.readInt();
baseIntent = in.readParcelable(Intent.class.getClassLoader());
baseActivity = in.readParcelable(ComponentName.class.getClassLoader());
topActivity = in.readParcelable(ComponentName.class.getClassLoader());
}
代码示例来源:origin: vondear/RxTool
@SuppressWarnings("WrongConstant")
public SavedState(Parcel source, ClassLoader loader) {
super(source);
facing = source.readInt();
ratio = source.readParcelable(loader);
autoFocus = source.readByte() != 0;
flash = source.readInt();
}
代码示例来源:origin: android-hacker/VirtualXposed
JobConfig(Parcel in) {
this.virtualJobId = in.readInt();
this.serviceName = in.readString();
this.extras = in.readParcelable(PersistableBundle.class.getClassLoader());
}
代码示例来源:origin: zhihu/Matisse
private Item(Parcel source) {
id = source.readLong();
mimeType = source.readString();
uri = source.readParcelable(Uri.class.getClassLoader());
size = source.readLong();
duration = source.readLong();
}
代码示例来源:origin: pockethub/PocketHub
protected IssueFilter(Parcel in) {
repository = in.readParcelable(Repository.class.getClassLoader());
labels = new ArrayList<>();
in.readList(labels, Label.class.getClassLoader());
milestone = in.readParcelable(Milestone.class.getClassLoader());
assignee = in.readParcelable(User.class.getClassLoader());
open = in.readByte() != 0;
direction = in.readString();
sortType = in.readString();
}
代码示例来源:origin: google/ExoPlayer
/* package */ ChapterFrame(Parcel in) {
super(ID);
this.chapterId = castNonNull(in.readString());
this.startTimeMs = in.readInt();
this.endTimeMs = in.readInt();
this.startOffset = in.readLong();
this.endOffset = in.readLong();
int subFrameCount = in.readInt();
subFrames = new Id3Frame[subFrameCount];
for (int i = 0; i < subFrameCount; i++) {
subFrames[i] = in.readParcelable(Id3Frame.class.getClassLoader());
}
}
代码示例来源:origin: florent37/MaterialViewPager
private SavedState(Parcel in) {
super(in);
this.settings = in.readParcelable(MaterialViewPagerSettings.class.getClassLoader());
this.yOffset = in.readFloat();
}
代码示例来源:origin: johncarl81/parceler
@Override
public Object mapValueFromParcel(Parcel parcel) {
return Parcels.unwrap(parcel.readParcelable(MapParcelable.class.getClassLoader()));
}
};
代码示例来源:origin: johncarl81/parceler
@Override
public Object mapValueFromParcel(Parcel parcel) {
return Parcels.unwrap(parcel.readParcelable(MapParcelable.class.getClassLoader()));
}
};
代码示例来源:origin: johncarl81/parceler
@Override
public Object mapValueFromParcel(Parcel parcel) {
return Parcels.unwrap(parcel.readParcelable(MapParcelable.class.getClassLoader()));
}
};
代码示例来源:origin: google/ExoPlayer
/* package */ ChapterTocFrame(Parcel in) {
super(ID);
this.elementId = castNonNull(in.readString());
this.isRoot = in.readByte() != 0;
this.isOrdered = in.readByte() != 0;
this.children = in.createStringArray();
int subFrameCount = in.readInt();
subFrames = new Id3Frame[subFrameCount];
for (int i = 0; i < subFrameCount; i++) {
subFrames[i] = in.readParcelable(Id3Frame.class.getClassLoader());
}
}
代码示例来源:origin: PhilJay/MPAndroidChart
protected Entry(Parcel in) {
this.x = in.readFloat();
this.setY(in.readFloat());
if (in.readInt() == 1) {
this.setData(in.readParcelable(Object.class.getClassLoader()));
}
}
代码示例来源:origin: robolectric/robolectric
@Override
public VisualVoicemailSms createFromParcel(Parcel in) {
VisualVoicemailSms sms = Shadow.newInstanceOf(VisualVoicemailSms.class);
ShadowVisualVoicemailSms shadowSms = Shadow.extract(sms);
shadowSms
.setPhoneAccountHandle(in.readParcelable(PhoneAccountHandle.class.getClassLoader()))
.setPrefix(in.readString())
.setFields(in.readBundle())
.setMessageBody(in.readString());
return sms;
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testParcelableWithPackageProtected() throws Exception {
TestParcelablePackage normal = new TestParcelablePackage(23);
parcel.writeParcelable(normal, 0);
parcel.setDataPosition(0);
TestParcelablePackage rehydrated = parcel.readParcelable(TestParcelablePackage.class.getClassLoader());
assertEquals(normal.contents, rehydrated.contents);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testParcelableWithBase() throws Exception {
TestParcelableImpl normal = new TestParcelableImpl(23);
parcel.writeParcelable(normal, 0);
parcel.setDataPosition(0);
TestParcelableImpl rehydrated = parcel.readParcelable(TestParcelableImpl.class.getClassLoader());
assertEquals(normal.contents, rehydrated.contents);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testParcelableWithPublicClass() throws Exception {
TestParcelable normal = new TestParcelable(23);
parcel.writeParcelable(normal, 0);
parcel.setDataPosition(0);
TestParcelable rehydrated = parcel.readParcelable(TestParcelable.class.getClassLoader());
assertEquals(normal.contents, rehydrated.contents);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void testReadWriteParcelable() {
Account a1 = new Account("name", "type");
parcel.writeParcelable(a1, 0);
parcel.setDataPosition(0);
Account a2 = parcel.readParcelable(Account.class.getClassLoader());
assertEquals(a1, a2);
}
内容来源于网络,如有侵权,请联系作者删除!