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

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

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

Parcel.createTypedArray介绍

[英]Read and return a new array containing a particular object type from the parcel at the current dataPosition(). Returns null if the previously written array was null. The array must have previously been written via #writeTypedArray with the same object type.
[中]从当前dataPosition()处的地块读取并返回包含特定对象类型的新数组。如果之前写入的数组为null,则返回null。数组必须以前使用相同的对象类型通过#WriteTypeArray写入。

代码示例

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

/* package */ DrmInitData(Parcel in) {
 schemeType = in.readString();
 schemeDatas = in.createTypedArray(SchemeData.CREATOR);
 schemeDataCount = schemeDatas.length;
}

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

/**
 * Re-create a SearchResult by deserializing data from a {@link android.os.Parcel}.
 *
 * @param parcel {@link android.os.Parcel} used to deserialize the SearchResult.
 */
protected SearchResult(Parcel parcel) {
 this.images = parcel.createTypedArrayList(Image.CREATOR);
 this.offset = parcel.readInt();
 this.query = parcel.createTypedArray(Tag.CREATOR);
 this.hasNextPage = (parcel.readByte() == 0x01);
}

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

protected ReceiverInfo(Parcel in) {
  this.component = in.readParcelable(ComponentName.class.getClassLoader());
  this.filters = in.createTypedArray(IntentFilter.CREATOR);
  this.permission = in.readString();
}

代码示例来源: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: wdullaer/MaterialDateTimePicker

@SuppressWarnings("WeakerAccess")
public DefaultTimepointLimiter(Parcel in) {
  mMinTime = in.readParcelable(Timepoint.class.getClassLoader());
  mMaxTime = in.readParcelable(Timepoint.class.getClassLoader());
  mSelectableTimes.addAll(Arrays.asList(in.createTypedArray(Timepoint.CREATOR)));
  mDisabledTimes.addAll(Arrays.asList(in.createTypedArray(Timepoint.CREATOR)));
  exclusiveSelectableTimes = getExclusiveSelectableTimes(mSelectableTimes, mDisabledTimes);
}

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

@Synthetic
UserItem(Parcel source) {
  id = source.readString();
  delay = source.readLong();
  created = source.readLong();
  karma = source.readLong();
  about = source.readString();
  submitted = source.createIntArray();
  submittedItems = source.createTypedArray(HackerNewsItem.CREATOR);
}

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

public static void readSignature(VPackage pkg) {
  File signatureFile = VEnvironment.getSignatureFile(pkg.packageName);
  if (!signatureFile.exists()) {
    return;
  }
  Parcel p = Parcel.obtain();
  try {
    FileInputStream fis = new FileInputStream(signatureFile);
    byte[] bytes = FileUtils.toByteArray(fis);
    fis.close();
    p.unmarshall(bytes, 0, bytes.length);
    p.setDataPosition(0);
    pkg.mSignatures = p.createTypedArray(Signature.CREATOR);
  } catch (IOException e) {
    e.printStackTrace();
  } finally {
    p.recycle();
  }
}

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

assertEquals("about", actualWrite.readString());
assertThat(actualWrite.createIntArray()).hasSize(3);
assertThat(actualWrite.createTypedArray(HackerNewsItem.CREATOR)).hasSize(3);

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

private VpnConfiguration(Parcel source) {
  int dnsCount = source.readInt();
  dnsServers = new InetAddress[dnsCount];
  try {
    for (int i = 0; i < dnsCount; ++i) {
      dnsServers[i] = InetAddress.getByAddress(source.createByteArray());
    }
  } catch (UnknownHostException e) {
    throw new AssertionError("Invalid address", e);
  }
  routes = source.createTypedArray(CIDR.CREATOR);
}

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

private SavedState(Parcel in) {
    super(in);
    savedSelectedFace = in.readInt();
    savedFaces = in.createTypedArray(Face.CREATOR);
  }
}

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

protected DataModel(Parcel in) {
 this.points = in.createTypedArray(LatLng.CREATOR);
 this.count = in.readInt();
}

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

public FragmentManagerState(Parcel in) {
  mActive = in.createTypedArray(FragmentState.CREATOR);
  mAdded = in.createIntArray();
  mBackStack = in.createTypedArray(BackStackState.CREATOR);
}

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

private UartConfiguration(final Parcel in) {
  id = in.readLong();
  name = in.readString();
  commands = in.createTypedArray(Command.CREATOR);
}

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

protected ExtraPolyline(Parcel in) {
  this.points = in.createTypedArray(LatLng.CREATOR);
  this.uiOptions = in.readParcelable(UiOptions.class.getClassLoader());
}

代码示例来源:origin: kingargyle/adt-leanback-support

public FragmentManagerState(Parcel in) {
  mActive = in.createTypedArray(FragmentState.CREATOR);
  mAdded = in.createIntArray();
  mBackStack = in.createTypedArray(BackStackState.CREATOR);
}

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

protected ExtraPolygon(Parcel in) {
  this.points = in.createTypedArray(LatLng.CREATOR);
  this.fillColor = in.readInt();
  this.uiOptions = in.readParcelable(UiOptions.class.getClassLoader());
}

代码示例来源:origin: darkskygit/VirtualApp

protected ReceiverInfo(Parcel in) {
  this.component = in.readParcelable(ComponentName.class.getClassLoader());
  this.filters = in.createTypedArray(IntentFilter.CREATOR);
  this.permission = in.readString();
}

代码示例来源:origin: bzsome/VirtualApp-x326

protected ReceiverInfo(Parcel in) {
  this.component = in.readParcelable(ComponentName.class.getClassLoader());
  this.filters = in.createTypedArray(IntentFilter.CREATOR);
  this.permission = in.readString();
}

代码示例来源:origin: SecUSo/privacy-friendly-sudoku

/** recreate object from parcel */
private GameBoard(Parcel in) {
  //private int id;
  gameType = in.readParcelable(GameType.class.getClassLoader());
  sectionHeight = in.readInt();
  sectionWidth = in.readInt();
  size = in.readInt();
  field = new GameCell[size][size];
  for(int i = 0; i < field.length; i++) {
    field[i] = in.createTypedArray(GameCell.CREATOR);
  }
}

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

protected MaskDescriptor(Parcel in) {
  this.slots = in.createTypedArray(Slot.CREATOR);
  this.rawMask = in.readString();
  this.initialValue = in.readString();
  this.terminated = in.readByte() != 0;
  this.forbidInputWhenFilled = in.readByte() != 0;
  this.hideHardcodedHead = in.readByte() != 0;
}

相关文章

Parcel类方法