我有一个扩展 Parcelable 的类,我们称之为 A 类。
我还有另一个扩展 Parcelable 的类,我们称之为 B 类。
A 的成员变量之一是 B 类对象的 ArrayList。
我正在尝试编写 Parcelable 覆盖,但无法弄清楚如何保存和读取 B 类的 ArrayList。
有一些方法可以读取和写入 ArrayList,但他们需要一个 ClassLoader 参数,我不熟悉它。我也可以将 ArrayList 复制到一个数组中,并使用读取和写入 Parcelable 数组的方法,但这也需要一个 ClassLoader 参数。
更新:
看起来像
in.readTypedList(mList, ClassB.CREATOR);
和
out.writeTypedList(mList);
我在找什么?