如何保存我的类中扩展 View 的所有字段的状态?
@Override
protected Parcelable onSaveInstanceState() {
Parcelable localState = super.onSaveInstanceState();
Bundle bundle = new Bundle();
bundle.putSerializable("gameEngine", this.gameEngine);
bundle.putParcelable("inherited", localState);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable localState) {
Bundle bundle = (Bundle) localState;
this.gameEngine = ((GameEngine) bundle.getSerializable("gameEngine"));
super.onRestoreInstanceState(bundle.getParcelable("inherited"));
}
这似乎并没有保存字段。
谢谢。