我想要實現的是勾選複選框,當離開活動並返回勾號應該仍然存在。不過,現在我打勾了,當去一個不同的活動,並返回打勾消失了。如何將複選框保存在複選框中?我怎樣才能保存勾選的複選框
這裏是我的代碼:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_tick, container, false);
CheckBox checkBox = (CheckBox) rootView.findViewById(R.id.checkBox62);
if(checkBox.isChecked())
checkBox.setChecked(false);
else
checkBox.setChecked(false);
return rootView;
}
}
任何幫助將不勝感激。
Strore在sharedpreferences複選框值。當進入這個屏幕首先檢查商店價值。 – 2014-11-05 13:49:04
你能告訴我如何實現這個? – wemapps 2014-11-05 14:16:19
閱讀本文http://stackoverflow.com/questions/23024831/android-shared-preferences-example http://stackoverflow.com/questions/14292984/using-shared-preference-save-5-check-box-value- IN-A-的ArrayList – 2014-11-05 14:40:42