关于把轮到哪个棋子走的状态保存下来的问题,请大神们来给我看看
@Override
protected Parcelable onSaveInstanceState() {
Bundle bundle=new Bundle();
bundle.putParcelable(INSTANCE,super.onSaveInstanceState());
bundle.putBoolean(INSTANCE_GAME_OVER,mIsGameOver);
//bundle.putBoolean(INSTANCE_IS_WHITE,mIsWhite);
bundle.putParcelableArrayList(INSTANCE_WHITE_ARRAY,(ArrayList)mWhiteArray);
bundle.putParcelableArrayList(INSTANCE_BLACK_ARRAY,(ArrayList)mBlackArray);
return bundle;
}
@Override
protected void onRestoreInstanceState(Parcelable state) {
if(state instanceof Bundle) {
Bundle bundle=(Bundle)state;
mIsGameOver=bundle.getBoolean(INSTANCE_GAME_OVER);
//mIsWhite=bundle.getBoolean(INSTANCE_IS_WHITE);
mWhiteArray=bundle.getParcelableArrayList(INSTANCE_WHITE_ARRAY);
mBlackArray=bundle.getParcelableArrayList(INSTANCE_BLACK_ARRAY);
super.onRestoreInstanceState(bundle.getParcelable(INSTANCE));
return;
}
super.onRestoreInstanceState(state);
}这个项目我还没开始做呢,看到view的存储的时候发现了这个缺陷,要把轮到哪个棋子走的这个状态也要保存下来吧,不知道我注释的那一段是否正确,请大神们指出来,谢谢 ~