在Android中,这段代码是否可以验证复选框是否被单击以取消选中?
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
Toast.makeText(IdentifyActivity.this, "clicked to check", Toast.LENGTH_LONG);
}
else{
Toast.makeText(IdentifyActivity.this, "clicked to uncheck", Toast.LENGTH_LONG);
}