> For the complete documentation index, see [llms.txt](https://jobinjj.gitbook.io/tutorials/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jobinjj.gitbook.io/tutorials/widgets/checkbox.md).

# Checkbox

#### Layout

```
<CheckBox android:id="@+id/option1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="option1" />
<CheckBox android:id="@+id/option2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="option2" />
```

#### Java

```
if  (((CheckBox) findViewById(R.id.option1)).isChecked()) {
    Toast.makeText(this, "Checked option1", Toast.LENGTH_SHORT).show();
}
if  (((CheckBox) findViewById(R.id.option2)).isChecked()) {
    Toast.makeText(this, "Checked option2", Toast.LENGTH_SHORT).show();

}
```
