【发布时间】:2016-08-01 13:50:07
【问题描述】:
我的班级中有一个名为“test”的稀疏数组。
“test”实现了“parcelable”,当我传递一个带有这样的 Intent 的对象 Test 时,我希望能够在两个活动之间检索我的 sparsearray:
Intent intent = new Intent();
intent.putExtra("myObjectTest", myObjectTest);
我看到有“writeSparseArray”方法,但它不适用于我的稀疏数组。
我当前的代码:
public Test(Parcel in) {
this.id = in.readInt();
// how to get the sparsearray ?
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(this.id);
// how can I parse my SparseArray ?
}
【问题讨论】:
-
SparseArray 存储的是哪种对象?
-
这是我做的一个类,实现了parcelable。
标签: android sparse-matrix parcelable serializable