Tom Tom - 1 month ago 6
Android Question

Android radio button if condition check

if(rs.getString(rs.getColumnIndex(DBHelper.GENDER)) != "female")
{
male.setChecked(true);
}
else
{
female.setChecked(true);
}
}


This code dosent work. It only show as male. How can i access it correctly.?

Answer

You need to change the code like this

 if(rs.getString(rs.getColumnIndex(DBHelper.GENDER)) .equals("Male"))
            {
                male.setChecked(true);
            }
            else
            {
                female.setChecked(true);
            }