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

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

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

Parcel.readStringArray介绍

[英]Read and return a String[] object from the parcel.
[中]从包裹中读取并返回字符串[]对象。

代码示例

代码示例来源:origin: smuyyh/BookReader

public SavedState(Parcel source) {
  super(source);
  tagCount = source.readInt();
  tags = new String[tagCount];
  source.readStringArray(tags);
  checkedPosition = source.readInt();
  input = source.readString();
}

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

String[] data = new String[3];
in.readStringArray(data);
this.id = data[0];
this.name = data[1];

代码示例来源:origin: googlesamples/android-testing

private LogHistory(Parcel in) {
    // First, read the size of the arrays that contain the data.
    int length = in.readInt();

    // Create the arrays to store the data.
    String[] texts = new String[length];
    long[] timestamps = new long[length];

    // Read the arrays in a specific order.
    in.readStringArray(texts);
    in.readLongArray(timestamps);

    // The lengths of both arrays should match or the data is corrupted.
    if (texts.length != timestamps.length) {
      throw new IllegalStateException("Error reading from saved state.");
    }

    // Reset the data container and update the data.
    mData.clear();
    for (int i = 0; i < texts.length; i++) {
      Pair<String, Long> pair = new Pair<>(texts[i], timestamps[i]);
      mData.add(pair);
    }
  }
}

代码示例来源:origin: robolectric/robolectric

@Test
public void testReadWriteStringArray() throws Exception {
 final String[] strings = { "foo", "bar" };
 parcel.writeStringArray(strings);
 parcel.setDataPosition(0);
 final String[] strings2 = new String[strings.length];
 parcel.readStringArray(strings2);
 assertTrue(Arrays.equals(strings, strings2));
}

代码示例来源:origin: codezjx/AndLinker

@Override
public void readFromParcel(Parcel in, String[] val) {
  in.readStringArray(val);
}

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

private PersonParcelable(Parcel in) {
  ...
  in.readStringArray(phones);
  in.readStringArray(mails);
  in.readStringArray(links);
}

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

public Student(Parcel in){
   String[] data = new String[3];
   in.readStringArray(data);
   this.id = data[0];
   this.name = data[1];
   this.grade = data[2];
 }

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

public Images(Parcel in) {
  in.readStringArray(this.imageUrls);
  in.readStringArray(this.imageThumbUrls);
}

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

private URL(Parcel in) {
  in.readStringArray(urls);
}

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

private String[] foo;
private void readFromParcel(Parcel in) {
    int cnt = in.readInt();
    foo = new String[cnt];
    in.readStringArray(foo);
  }

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

public Articles (Parcel in)
{
    String[] data = new String[3];// here you defined array of 3 elements it should be 4
    in.readStringArray(data);
    this.id = Integer.parseInt(data[0]);
    this.description = data[1];
    this.immagine = data[2];
    this.quantita = Integer.parseInt(data[3]);
}

代码示例来源:origin: apptentive/apptentive-android

private ImageItem(Parcel in){
  String[] data = new String[4];
  in.readStringArray(data);
  this.originalPath = data[0];
  this.localCachePath = data[1];
  this.mimeType = data[2];
  this.time = Long.valueOf(data[3]);
}

代码示例来源:origin: easytargetmixel/micopi_android

public Contact(Parcel in) {
    String[] data = new String[8];

    in.readStringArray(data);

    mId = Long.parseLong(data[0]);
    mFullName = data[1];
    mPhoneNumber = data[2];
    mEmailAddress = data[3];
    mBirthday = data[4];
    mRetryFactor = Integer.parseInt(data[5]);
    mMd5String = data[6];
//        mPhotoUri = Uri.parse(data[7]);
  }

代码示例来源:origin: baasbox/Android-SDK

private static void readStringSet(Parcel p, Set<String> set) {
  int size = p.readInt();
  String[] arr = new String[size];
  p.readStringArray(arr);
  Collections.addAll(set, arr);
}

代码示例来源:origin: xkzh/yduoduo

public SavedState(Parcel source) {
  super(source);
  tagCount = source.readInt();
  tags = new String[tagCount];
  source.readStringArray(tags);
  checkedPosition = source.readInt();
  input = source.readString();
}

代码示例来源:origin: lynfogeek/conference-app

protected Conference(Parcel in) {
  CSVLine = new String[in.readInt()];
  in.readStringArray(this.CSVLine);
  this.startDate = in.readString();
  this.endDate = in.readString();
  this.headeline = in.readString();
  this.speaker = in.readString();
  this.speakerImageUrl = in.readString();
  this.text = in.readString();
  this.location = in.readString();
  this.calendar = (Calendar) in.readSerializable();
}

代码示例来源:origin: com.albedinsky.android/dialogs

/**
 * Called form {@link #CREATOR} to create an instance of LocaleOptions form the given parcel
 * <var>source</var>.
 *
 * @param source Parcel with data for the new instance.
 */
protected LocaleOptions(@NonNull Parcel source) {
  super(source);
  this.mode = source.readInt();
  excludeCountryCodes = new String[source.readInt()];
  source.readStringArray(excludeCountryCodes);
  this.selection = source.readLong();
  this.searchHint = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
  this.searchQuery = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
}

代码示例来源:origin: com.albedinsky.android.support/support-dialogs

/**
 * Called form {@link #CREATOR} to create an instance of LocaleOptions form the given parcel
 * <var>source</var>.
 *
 * @param source Parcel with data for the new instance.
 */
protected LocaleOptions(@NonNull Parcel source) {
  super(source);
  this.mode = source.readInt();
  excludeCountryCodes = new String[source.readInt()];
  source.readStringArray(excludeCountryCodes);
  this.selection = source.readLong();
  this.searchHint = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
  this.searchQuery = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
}

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

in.readStringArray(data);

代码示例来源:origin: Belolme/RxBLE

private BLEDevice(Parcel in) {
  int[] intArr = new int[1];
  in.readIntArray(intArr);
  setRssi(intArr[0]);
  String[] strings = new String[3];
  in.readStringArray(strings);
  setDeviceName(strings[0]);
  setMac(strings[1]);
}

相关文章

Parcel类方法