You are saving vallues but you have to restore them you your activity is started like this :
SharedPreferences prefs = getSharedPreferences("syllabus", 0);
checkbox1.setChecked(prefs.getBoolean("cbx1_ischecked" ,false));
checkbox2.setChecked(prefs.getBoolean("cbx2_ischecked" ,false));
manpreet
Best Answer
2 years ago
I am developing an application. There are many checkbox in one page. I want to save the state of CheckBox when I exit page. I use SharedPreferrences to save. The code is like this:
When I leave this page, and back again. All the checkbox state becomes not selected as default. why?