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

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

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

Parcel.readArray介绍

[英]Read and return a new Object array from the parcel at the current dataPosition(). Returns null if the previously written array was null. The given class loader will be used to load any enclosed Parcelables.
[中]从当前dataPosition()处的地块读取并返回新的对象数组。如果之前写入的数组为null,则返回null。给定的类装入器将用于装入任何封闭的包裹。

代码示例

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

private ProgramacionPelicula(Parcel in) {
  this();
  setIdProgramacion(in.readInt());
  setSala(in.readString());

  _pelicula = in.readParcelable(Pelicula.class.getClassLoader());

  setTandas(in.readArray(Tanda.class.getClassLoader()));
}

代码示例来源:origin: 8enet/AppOpsX

protected SystemServiceCaller(Parcel in) {
  this.serviceName = in.readString();
  this.methodName = in.readString();
  this.sParamsType = in.createStringArray();
  this.params = in.readArray(Object[].class.getClassLoader());
}

代码示例来源:origin: 8enet/AppOpsX

protected ClassCaller(Parcel in) {
  this.packageName = in.readString();
  this.className = in.readString();
  this.sParamsType = in.createStringArray();
  this.params = in.readArray(Object[].class.getClassLoader());
}

代码示例来源:origin: yuger/VPN_2017

public LogItem(Parcel in) {
  mArgs = in.readArray(Object.class.getClassLoader());
  mMessage = in.readString();
  mRessourceId = in.readInt();
  mLevel = VpnStatus.LogLevel.getEnumByValue(in.readInt());
  mVerbosityLevel = in.readInt();
  logtime = in.readLong();
}

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

@Override
  public void writeToParcel(Parcel dest, int flags) {    
    dest.writeString(mTitleError);
    dest.writeString(mDescriptionError);
    Exception[] exceptions = new Exception[1];
    exceptions[0] = mExceptionError;
    dest.writeArray(exceptions);
  }

public ReportErrorVO(Parcel in) {
    mTitleError = in.readString();
    mDescriptionError = in.readString();
    Object[] exceptions = in.readArray(Exception.class.getClassLoader());
    mExceptionError = (Exception) exceptions[0];
  }

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

public void writeToParcel(Parcel dest, int flags) {

  dest.writeString(mSName);
  dest.writeInt(mSAge);
  dest.writeArray(a);
}

private Student(Parcel in){
  this.mSName = in.readString();
  this.mSAge = in.readInt();

  Object[] objects = in.readArray(null);
  a = new String[objects.length];
  for( int i = 0; i < size; i++){
   this.a[i] = objects[i];
  }
  }

代码示例来源:origin: LightSun/data-mediator

protected HistoryData(Parcel in) {
  this.age = in.readInt();
  this.id = in.readLong();
  this.testShort = (short) in.readInt();
  this.testByte = in.readByte();
  this.testBoolean = in.readByte() != 0;
  this.testFloat = in.readFloat();
  this.testDouble = in.readDouble();
  this.testChar = (char) in.readInt();
  this.testLONG = (Long) in.readValue(Long.class.getClassLoader());
  this.testDOUBLE = (Double) in.readValue(Double.class.getClassLoader());
  this.testCharacter = (Character) in.readSerializable();
  this.testBOOLEAN = (Boolean) in.readValue(Boolean.class.getClassLoader());
  this.testSHORT = (Short) in.readValue(Short.class.getClassLoader());
  this.name = in.readString();
  this.data = in.readParcelable(ResultData.class.getClassLoader());
  this.datas = in.createTypedArrayList(ResultData.CREATOR);
  this.testArrayResultData = in.createTypedArray(ResultData.CREATOR);
  this.testArrayInt = in.createIntArray();
  this.testArrayInteger = (Integer[]) in.readArray(Integer[].class.getClassLoader());
}

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

public void handleTransact(Object server, Parcel data, Parcel reply) {
  data.enforceInterface(interfaceName);
  Object[] parameters = data.readArray(getClass().getClassLoader());
  if (parameters != null && parameters.length > 0) {
    for (int i = 0; i < parameters.length; i++) {
      if (converters[i] != null) {
        parameters[i] = converters[i].convert(parameters[i]);
      }
    }
  }
  try {
    Object res = method.invoke(server, parameters);
    reply.writeNoException();
    reply.writeValue(res);
  } catch (IllegalAccessException e) {
    e.printStackTrace();
    reply.writeException(e);
  } catch (InvocationTargetException e) {
    e.printStackTrace();
    reply.writeException(e);
  }
}

相关文章

Parcel类方法