ChapterFrame extends Id3Frame { @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(chapterId); dest.writeInt(startTimeMs); dest.writeInt(endTimeMs); dest.writeLong(startOffset); dest.writeLong(endOffset); dest.writeInt(subFrames.length); for (Id3Frame subFrame : subFrames) { dest.writeParcelable(subFrame, 0); } } ChapterFrame(String chapterId, int startTimeMs, int endTimeMs, long startOffset,
      long endOffset, Id3Frame[] subFrames);   ChapterFrame(Parcel in); int getSubFrameCount(); Id3Frame getSubFrame(int index); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); @Override void writeToParcel(Parcel dest, int flags); @Override int describeContents(); static final String ID; final String chapterId; final int startTimeMs; final int endTimeMs; final long startOffset; final long endOffset; static final Creator<ChapterFrame> CREATOR; }
@Test public void testParcelable() { Id3Frame[] subFrames = new Id3Frame[] { new TextInformationFrame("TIT2", null, "title"), new UrlLinkFrame("WXXX", "description", "url") }; ChapterFrame chapterFrameToParcel = new ChapterFrame("id", 0, 1, 2, 3, subFrames); Parcel parcel = Parcel.obtain(); chapterFrameToParcel.writeToParcel(parcel, 0); parcel.setDataPosition(0); ChapterFrame chapterFrameFromParcel = ChapterFrame.CREATOR.createFromParcel(parcel); assertThat(chapterFrameFromParcel).isEqualTo(chapterFrameToParcel); parcel.recycle(); }