I have strange issue. My application have multiple activitys, on one activity is setting with two check boxes couple of spinners and save button.
When it first start, after installation I click button that bring up setting and in setting activity is this this on create:
final CheckBox checkBox1st = (CheckBox) findViewById(R.id.checkBox1st);
final CheckBox checkBox2nd = (CheckBox) findViewById(R.id.checkBox2nd);
// set checkers from sharesetting
String XX = GetPreference("lajna", "1");
if (XX == "1") {
checkBox1st.setChecked(true);
checkBox2nd.setChecked(false);
//updatneme spiner s menami podla lajn
db.openToRead();
updateSpiner("1"); //update appropriate spinner
db.close();
}
if (XX == "2") {
checkBox1st.setChecked(false);
checkBox2nd.setChecked(true);
//updatneme spiner s menami podla lajny
db.openToRead();
updateSpiner("2"); //update appropriate spinner
db.close();
}
so point of this is to read the shared setting and set checkbox as set … but it doesnt do it at first, and the shared preference value is set.. even if it would not it still should go with value 1 no ? but it doesn’t check any checker..
if I save the setting or use back button and than go to setting again it shows normal…
any idea why it is behave like this ?
Thanks,
Vlad
“1”.equals(XX), string comparison should use equals not ==.