我想用共享偏好等提交按鈕,我可以得到所有的變化值,以節省RadioButton
狀態..如何保存Android上的單選按鈕狀態?
我要救的RadioButton
所有狀態和上一個和下一個按鈕就必須節省點擊國家。
我想用共享偏好等提交按鈕,我可以得到所有的變化值,以節省RadioButton
狀態..如何保存Android上的單選按鈕狀態?
我要救的RadioButton
所有狀態和上一個和下一個按鈕就必須節省點擊國家。
將您的信息存儲在像這樣的SharedPreferences中。
SharedPreferences settings = getSharedPreferences("Answers", 0);
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("questionA", radBotA.isChecked());
editor.putBoolean("questionB", radBotB.isChecked());
editor.putBoolean("questionC", radBotC.isChecked());
editor.putBoolean("questionD", radBotD.isChecked());
editor.commit();
回來的活動調用此onStart()
SharedPreferences settings = getSharedPreferences("Answers", 0);
radBotA.setChecked(settings.getBoolean("questionA", false));
radBotB.setChecked(settings.getBoolean("questionB", false));
radBotC.setChecked(settings.getBoolean("questionC", false));
radBotD.setChecked(settings.getBoolean("questionD", false));
感謝比爾蓋茨,我將如何加載下一個和上一個按鈕,請告訴:)),現在 我只是想在下一個按鈕點擊我會按下一些選項,當我點擊上一個按鈕時,它會顯示單選按鈕因爲我選擇 – himanshu8767 2013-02-26 08:54:39
下一個按鈕你是否要去其他活動? – 2013-02-26 08:56:53
沒有我稱爲哈希映射,所以它會通過ID值和對象,它會設置問題和選項屏幕 – himanshu8767 2013-02-26 08:57:54
http://whathaveyoutried.com什麼時候? – njzk2 2013-02-26 08:38:36
http://stackoverflow.com/questions/14586837/android-save-state-of-radio-buttons – yarian 2013-02-26 08:39:41
http://stackoverflow.com/questions/13946800/android-help-in-radiobutton-toast/13946832#13946832 – 2013-02-26 08:42:28