我在主屏幕上有一個「繼續」和一個「新遊戲」按鈕。當點擊「新遊戲」按鈕下面的代碼運行:設置繼續按鈕以恢復之前的活動
Case:R.id.new_button:
Intent = new Intent(this, Difficulty.class);
startActivity(openDifficulty);
break;
,然後打開「難度」的活動畫面,其中包含了「易」和「硬」按鈕。 當「硬」按鈕被點擊例如「易」或本上運行:
case R.id.easy_button:
Intent openEasy = new Intent(this, EasyGameScreen.class);
startActivity(openEasy);
break;
case R.id.hard_button:
Intent openHard = new Intent(this, HardGameScreen.class);
startActivity(openHard);
break;
,然後將用戶帶到相應級別
我怎樣才能獲得「繼續」按鈕來恢復以前的遊戲從完全相同的角度來看呢?
感謝所有幫助
所以我如何保存遊戲的狀態。是不是像super.onCreate(savedInstanceState); – user2111061 2013-02-27 16:58:44
使用sharedprefernces或sqlite數據庫進行持久性存儲 – 2013-02-27 17:01:52