Search code examples
androidcheckboxnullstatus

Android CheckBox with indeterminated Status?


in an android-project I need to have a checkbox which may have an indeterminate status, depending on the case if it is optional (true/false/null) or necessary (true/false) to set a value with this checkbox.

While this is possible on MS.Net/WinForms I have no idea if there's a comparable possibility on Java/Android, as I found no documentation about this in the android-docs.

Any ideas about this? Additional info: the layout is XML-based.

Christoph


Solution

  • No, it's not possible with a check box. What you can do, however, is use a RadioButton and a RadioGroup. You can still have just 2 options but you will be able to account for the case where nothing has been selected.