Stay organized with collections
Save and categorize content based on your preferences.
Checkable
public
interface
Checkable
Known indirect subclasses
CheckBox |
A checkbox is a specific type of two-states button that can be either
checked or unchecked.
|
CheckedTextView |
An extension to TextView that supports the Checkable
interface and displays.
|
CompoundButton |
A button with two states, checked and unchecked.
|
RadioButton |
A radio button is a two-states button that can be either checked or
unchecked.
|
Switch |
A Switch is a two-state toggle widget.
|
ToggleButton |
Displays checked/unchecked states as a button
with a "light" indicator and by default accompanied with the text "ON" or "OFF".
|
|
Defines an extension for views that make them checkable.
Summary
Public methods |
abstract
boolean
|
isChecked()
|
abstract
void
|
setChecked(boolean checked)
Change the checked state of the view
|
abstract
void
|
toggle()
Change the checked state of the view to the inverse of its current state
|
Public methods
isChecked
public abstract boolean isChecked ()
Returns |
boolean |
The current checked state of the view |
setChecked
public abstract void setChecked (boolean checked)
Change the checked state of the view
Parameters |
checked |
boolean : The new checked state |
toggle
public abstract void toggle ()
Change the checked state of the view to the inverse of its current state
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Checkable\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nCheckable\n=========\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/widget/Checkable \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nCheckable\n`\n\n\n`\n\n\n`\n\n|--------------------------|\n| android.widget.Checkable |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [CheckBox](/reference/android/widget/CheckBox), [CheckedTextView](/reference/android/widget/CheckedTextView), [CompoundButton](/reference/android/widget/CompoundButton), [RadioButton](/reference/android/widget/RadioButton), [Switch](/reference/android/widget/Switch), [ToggleButton](/reference/android/widget/ToggleButton) |--------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | [CheckBox](/reference/android/widget/CheckBox) | A checkbox is a specific type of two-states button that can be either checked or unchecked. | | [CheckedTextView](/reference/android/widget/CheckedTextView) | An extension to [TextView](/reference/android/widget/TextView) that supports the [Checkable](/reference/android/widget/Checkable) interface and displays. | | [CompoundButton](/reference/android/widget/CompoundButton) | A button with two states, checked and unchecked. | | [RadioButton](/reference/android/widget/RadioButton) | A radio button is a two-states button that can be either checked or unchecked. | | [Switch](/reference/android/widget/Switch) | A Switch is a two-state toggle widget. | | [ToggleButton](/reference/android/widget/ToggleButton) | Displays checked/unchecked states as a button with a \"light\" indicator and by default accompanied with the text \"ON\" or \"OFF\". | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nDefines an extension for views that make them checkable.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[isChecked](/reference/android/widget/Checkable#isChecked())`() ` |\n| ` abstract void` | ` `[setChecked](/reference/android/widget/Checkable#setChecked(boolean))`(boolean checked) ` Change the checked state of the view |\n| ` abstract void` | ` `[toggle](/reference/android/widget/Checkable#toggle())`() ` Change the checked state of the view to the inverse of its current state |\n\nPublic methods\n--------------\n\n### isChecked\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isChecked ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-----------|----------------------------------------------|\n| `boolean` | The current checked state of the view \u003cbr /\u003e |\n\n### setChecked\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void setChecked (boolean checked)\n```\n\nChange the checked state of the view\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-----------------------------------------|\n| `checked` | `boolean`: The new checked state \u003cbr /\u003e |\n\n### toggle\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void toggle ()\n```\n\nChange the checked state of the view to the inverse of its current state\n\n\u003cbr /\u003e"]]