android.os.Parcel.writeTypedArray()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(191)

本文整理了Java中android.os.Parcel.writeTypedArray()方法的一些代码示例,展示了Parcel.writeTypedArray()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parcel.writeTypedArray()方法的具体详情如下:
包路径:android.os.Parcel
类名称:Parcel
方法名:writeTypedArray

Parcel.writeTypedArray介绍

[英]Flatten a heterogeneous array containing a particular object type into the parcel, at the current dataPosition() and growing dataCapacity() if needed. The type of the objects in the array must be one that implements Parcelable. Unlike the #writeParcelableArray method, however, only the raw data of the objects is written and not their type, so you must use #readTypedArraywith the correct corresponding Parcelable.Creator implementation to unmarshall them.
[中]将包含特定对象类型的异构阵列展平到地块中,在当前dataPosition()处,如果需要,增加dataCapacity()。数组中对象的类型必须是实现Parcelable的类型。但是,与#writeParcelableArray方法不同,只写入对象的原始数据,而不写入对象的类型,因此必须使用#ReadTypeDarray和正确的对应Parcelable。创建者实现来解组它们。

代码示例

代码示例来源:origin: google/ExoPlayer

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeString(schemeType);
 dest.writeTypedArray(schemeDatas, 0);
}

代码示例来源:origin: android-hacker/VirtualXposed

@Override
  public void writeToParcel(Parcel dest, int flags) {
    dest.writeParcelable(this.component, flags);
    dest.writeTypedArray(this.filters, flags);
    dest.writeString(this.permission);
  }
}

代码示例来源:origin: rey5137/material

@Override
public void writeToParcel(@NonNull Parcel out, int flags) {
  super.writeToParcel(out, flags);
  int length = recipients == null ? 0 : recipients.length;
  out.writeInt(length);
  if(length > 0)
    out.writeTypedArray(recipients, flags);
}

代码示例来源:origin: wdullaer/MaterialDateTimePicker

@Override
public void writeToParcel(Parcel out, int flags) {
  out.writeParcelable(mMinTime, flags);
  out.writeParcelable(mMaxTime, flags);
  out.writeTypedArray(mSelectableTimes.toArray(new Timepoint[mSelectableTimes.size()]), flags);
  out.writeTypedArray(mDisabledTimes.toArray(new Timepoint[mDisabledTimes.size()]), flags);
}

代码示例来源:origin: stackoverflow.com

MyClass[] mObjList;

public void writeToParcel(Parcel out) {
  out.writeTypedArray(mObjList, 0);
}

private void readFromParcel(Parcel in) {
  mObjList = in.createTypedArray(MyClass.CREATOR);
}

代码示例来源:origin: hidroh/materialistic

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(id);
  dest.writeLong(delay);
  dest.writeLong(created);
  dest.writeLong(karma);
  dest.writeString(about);
  dest.writeIntArray(submitted);
  dest.writeTypedArray(submittedItems, flags);
}

代码示例来源:origin: android-hacker/VirtualXposed

p.writeTypedArray(signatures, 0);
  FileUtils.writeParcelToFile(p, signatureFile);
} catch (IOException e) {

代码示例来源:origin: hidroh/materialistic

parcel.writeString("about");
parcel.writeIntArray(new int[]{1, 2, 3});
parcel.writeTypedArray(new HackerNewsItem[]{
    new HackerNewsItem(1L),
    new HackerNewsItem(2L),

代码示例来源:origin: Genymobile/gnirehtet

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeInt(dnsServers.length);
  for (InetAddress addr : dnsServers) {
    dest.writeByteArray(addr.getAddress());
  }
  dest.writeTypedArray(routes, 0);
}

代码示例来源:origin: stackoverflow.com

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeInt(mMyArray.length);
  dest.writeTypedArray(mMyArray, flags);
}

代码示例来源:origin: bkhezry/ExtraMapUtils

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeTypedArray(this.points, flags);
  dest.writeParcelable(this.uiOptions, flags);
}

代码示例来源:origin: com.google.android/support-v4

public void writeToParcel(Parcel dest, int flags) {
  dest.writeTypedArray(mActive, flags);
  dest.writeIntArray(mAdded);
  dest.writeTypedArray(mBackStack, flags);
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox

@Override
  public void writeToParcel(final Parcel dest, int flags) {
    dest.writeLong(id);
    dest.writeString(name);
    dest.writeTypedArray(commands, 0);
  }
}

代码示例来源:origin: markusfisch/ShaderEditor

@Override
public void writeToParcel(Parcel out, int flags) {
  super.writeToParcel(out, flags);
  out.writeInt(savedSelectedFace);
  out.writeTypedArray(savedFaces, flags);
}

代码示例来源:origin: bkhezry/ExtraMapUtils

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeTypedArray(this.points, flags);
  dest.writeInt(this.fillColor);
  dest.writeParcelable(this.uiOptions, flags);
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
public void writeToParcel(Parcel parcel, int i) {
  parcel.writeString(path);
  parcel.writeInt(hidden);
  AlbumItem[] albumItems = new AlbumItem[this.albumItems.size()];
  for (int k = 0; k < albumItems.length; k++) {
    albumItems[k] = this.albumItems.get(k);
  }
  parcel.writeTypedArray(albumItems, 0);
}

代码示例来源:origin: TinkoffCreditSystems/decoro

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeTypedArray(this.slots, flags);
  dest.writeString(this.rawMask);
  dest.writeString(this.initialValue);
  dest.writeByte(this.terminated ? (byte) 1 : (byte) 0);
  dest.writeByte(this.forbidInputWhenFilled ? (byte) 1 : (byte) 0);
  dest.writeByte(this.hideHardcodedHead ? (byte) 1 : (byte) 0);
}

代码示例来源:origin: kollerlukas/Camera-Roll-Android-App

@Override
public void writeToParcel(Parcel parcel, int i) {
  parcel.writeString(path);
  parcel.writeString(name);
  parcel.writeString(String.valueOf(isMedia));
  File_POJO[] children = new File_POJO[this.children.size()];
  for (int k = 0; k < children.length; k++) {
    children[k] = this.children.get(k);
  }
  parcel.writeTypedArray(children, 0);
  parcel.writeString(String.valueOf(excluded));
}

代码示例来源:origin: tjg1/nori

@Override
public void writeToParcel(Parcel dest, int flags) {
 dest.writeTypedList(images);
 dest.writeInt(offset);
 dest.writeTypedArray(query, 0);
 dest.writeByte((byte) (hasNextPage ? 0x01 : 0x00));
}
//endregion

代码示例来源:origin: stackoverflow.com

public void writeToParcel(Parcel out, int arg1) {
  out.writeInt(mObjList.length);
  out.writeTypedArray(mObjList, arg1);
}

private void readFromParcel(Parcel in) {
  int size = in.readInt();
  mObjList = in.readTypedArray(new MyClass[size], MyClass.CREATOR);
}

相关文章

Parcel类方法