I have a class: class PartStoreModel implements Parcelable
which contains some properties such as: id, name, address
. In this function I must override
function: public void writeToParcel(Parcel dest, int flags)
(I left this function empty, don't do anything):
@Override
public void writeToParcel(Parcel dest, int flags) {
// Do nothing here
}
// This is how I save on configuration change:
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList(KEY_INVENTORY_GROUP_SAVED,
mPartStoreModels);
}
The problem is that It worked perfect!. So why I have to override writeToParcel
function, when I can leave it blank? Can anyone explains it? (I usually override writeToParcel
function, and PartStoreModel(Parcel in)
as write
and read
function, but nothing is better than leave them blank!)