Can anyone can tell me when to use Checkbox and when Switch?

I mean, what is the real login difference between the two in the context of a PreferenceActivity?

For example, will you change the next section to Checkboxes? It's part of a set, but using a Switch here looks better.

enter image description here


Solution 1:

I actually find this to be quite an interesting question, particularly considering that one can easily emulate the functionality of a switch using a checkbox in Android.

According to the Android developers guide, a checkbox is simply a type of switch. Check the quotes below or read the full description here.

Checkboxes: Checkboxes allow the user to select multiple options from a set. Avoid using a single checkbox to turn an option off or on. Instead, use an on/off switch.

On/off Switches: On/off switches toggle the state of a single settings option.

Solution 2:

Disclaimer I'm not UX expert.

Besides what @KentHawkings has already cited from Google's design guidelines (checkboxes for list of non-exclusive options and switch for a single option), there is a good (IMHO) use case for checkbox for a single option - when the checkbox clearly means yes/no.

Good idea for checkbox: "Show notifications" option.

Bad idea for checkbox: "Wi-Fi" option (as in Android Settings).
You could use checkbox here if this option was titled "Wi-Fi is enabled", but quite obviously "Wi-Fi" with "On/Off" switch is more concise.

Note that Play Market doesn't follow Google's own guidline - it uses checkboxes in its Settings all over the place.

Solution 3:

After following the Settings option in android device, my opinion for difference between checkbox and switch is that:

  1. CheckBox are usually used to mark/unmark the particular setting in the service.
  2. Switches are used to turnOn/turnOff the particular services.

Possibly, that is why checkbox are treated as subset/type of switch as they allow to mark/unmark an option within the service itself( not the entire service).