开发者

Checkbox status issue

开发者 https://www.devze.com 2023-01-29 14:04 出处:网络
How we can know whether the check box is checked 开发者_JS百科or unchecked using java codeboolean checkBox.isChecked()

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消