0

What is the difference in doing the following using Toggle buttons?

togglebut.isChecked();
togglebut.isSelected();

and similarly setSelected() and setChecked().

-EDIT- The question has now been answered as a community wiki and includes the Activated case too.

Ankit Aggarwal
  • 2,367
  • 24
  • 30
  • 2
    http://stackoverflow.com/questions/11504860/what-is-the-difference-between-the-states-selected-checked-and-activated-in-and ;) – Skaard-Solo Jul 24 '13 at 11:09

1 Answers1

0

I hadn't referred to the docs before asking this question. The doc actually makes it clear. I am answering this so that anyone who gets to this question actually gets a meaningful answer. According to the doc.

android:state_selected Boolean. "true" if this item should be used when the object is the current user selection when navigating with a directional control (such as when navigating through a list with a d-pad); "false" if this item should be used when the object is not selected. The selected state is used when focus (android:state_focused) is not sufficient (such as when list view has focus and an item within it is selected with a d-pad).

android:state_checked Boolean. "true" if this item should be used when the object is checked; "false" if it should be used when the object is un-checked.

android:state_activated Boolean. "true" if this item should be used when the object is activated as the persistent selection (such as to "highlight" the previously selected list item in a persistent navigation view); "false" if it should be used when the object is not activated. Introduced in API level 11.

For further details refer to the link posted in the comment above. It elaborates on this.

Ankit Aggarwal
  • 2,367
  • 24
  • 30