我正在尝试将 Long[] 数组写入包裹,但它只接受 long[] 数组作为参数。
( Parcel 类型中的 writeLongArray(long[]) 方法不适用于参数 (Long[]) )
public class SomeClass implements Parcelable {
private Long minutes, lastUpdated;
...
...
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeLongArray(new Long[] {this.minutes, this.lastUpdated });
}
这似乎可行,但这是否允许:
out.writeLongArray(new long[] {this.minutes, this.lastUpdated });