i have data in database with value from checkbox
i try to set checkbox with value from database, if database not null checkbox checked but if null checkbox not checked..
my code like this:
public void load(){
final Cursor c = helper.getSat(almagId);
c.moveToFirst();
if(c.getString(3) != null){
ch1.isChecked();
}
isi2.setText(c.getString(4));
if(c.getString(4) != null){
ch2.isChecked();
}
isi3.setText(c.getString(5));
if(c.getString(5) != null){
ch3.isChecked();
}
}
but it's not work..how can i solve this??thank you for feed back :)
isChecked()
will tell you if the CheckBox
is checked or not; you cannot change the 'checked' value with this method.
In order to change it, use either setChecked(boolean)
for an explicit value or toggle()
to inverse it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With