How we can know whether the check box is checked 开发者_JS百科or unchecked using java code
boolean checkBox.isChecked()
returns true if your 'checkBox' is checked, returns false otherwise.
If your checkbox is part of a preference menu, you can do:
boolean checked;
checked = preferences.getBoolean("checkBoxName", true);
Where "preferences" is your SharedPreferences object.
See this page for further reference on how to implement a preference menu.
精彩评论