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

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

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

Parcel.writeArray介绍

[英]Flatten an Object array into the parcel at the current dataPosition(), growing dataCapacity() if needed. The array values are written using #writeValue and must follow the specification there.
[中]在当前dataPosition()处将对象数组展平到地块中,必要时增加dataCapacity()。数组值是使用#writeValue写入的,必须遵循那里的规范。

代码示例

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

@Override
protected void onWriteToParcel(Parcel dest, int flags) {
  dest.writeInt(mMode);
  switch (mMode){
    case MODE_MESSAGE:
      dest.writeValue(mMessage);
      break;
    case MODE_ITEMS:
      dest.writeArray(mItems);
      dest.writeInt(mSelectedIndexes == null ? 0 : mSelectedIndexes[0]);
      break;
    case MODE_MULTI_ITEMS:
      dest.writeArray(mItems);
      int length = mSelectedIndexes == null ? 0 : mSelectedIndexes.length;
      dest.writeInt(length);
      if(length > 0)
        dest.writeIntArray(mSelectedIndexes);
      break;
    }
  }

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

@Override
public void writeToParcel(Parcel dest, int flags) {

  dest.writeInt(getIdProgramacion());
  dest.writeString(getSala());

  dest.writeParcelable(_pelicula, flags);

  Object[] objectsPeliculas = peliculas.toArray();
  dest.writeArray(objectsPeliculas);

  Object[] objectsTanda = getTandas().toArray();
  dest.writeArray(objectsTanda);
}

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

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(this.serviceName);
  dest.writeString(this.methodName);
  dest.writeStringArray(this.sParamsType);
  dest.writeArray(this.params);
}

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

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeString(this.packageName);
  dest.writeString(this.className);
  dest.writeStringArray(this.sParamsType);
  dest.writeArray(this.params);
}

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

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeArray(mArgs);
  dest.writeString(mMessage);
  dest.writeInt(mRessourceId);
  dest.writeInt(mLevel.getInt());
  dest.writeInt(mVerbosityLevel);
  dest.writeLong(logtime);
}

代码示例来源: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: 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: LightSun/data-mediator

@Override
public void writeToParcel(Parcel dest, int flags) {
  dest.writeInt(this.age);
  dest.writeLong(this.id);
  dest.writeInt(this.testShort);
  dest.writeByte(this.testByte);
  dest.writeByte(this.testBoolean ? (byte) 1 : (byte) 0);
  dest.writeFloat(this.testFloat);
  dest.writeDouble(this.testDouble);
  dest.writeInt(this.testChar);
  dest.writeValue(this.testLONG);
  dest.writeValue(this.testDOUBLE);
  dest.writeSerializable(this.testCharacter);
  dest.writeValue(this.testBOOLEAN);
  dest.writeValue(this.testSHORT);
  dest.writeString(this.name);
  dest.writeParcelable(this.data, flags);
  dest.writeTypedList(this.datas);
  dest.writeTypedArray(this.testArrayResultData, flags);
  dest.writeIntArray(this.testArrayInt);
  dest.writeArray(this.testArrayInteger);
}

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

public Object callRemote(IBinder server, Object[] args) throws RemoteException {
  Parcel data = Parcel.obtain();
  Parcel reply = Parcel.obtain();
  Object result;
  try {
    data.writeInterfaceToken(interfaceName);
    data.writeArray(args);
    server.transact(code, data, reply, 0);
    reply.readException();
    result = readValue(reply);
    if (resultConverter != null) {
      result = resultConverter.convert(result);
    }
  } finally {
    data.recycle();
    reply.recycle();
  }
  return result;
}

相关文章

Parcel类方法