public class MultipleChoiceMode extends ObservableChoiceMode
ChoiceMode that allows any number of items to be chosen.| Constructor and Description |
|---|
MultipleChoiceMode() |
MultipleChoiceMode(Bundle savedInstanceState) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearChoices()
Clears any checked items.
|
int |
getCheckedItemCount()
Returns the number of items currently selected.
|
LongArrayList |
getCheckedItems()
Returns an unsorted
LongArrayList of checked item ids. |
boolean |
isActivated()
Returns true if choice mode is active.
|
boolean |
isItemChecked(long itemId)
Returns the checked state of the specified position.
|
boolean |
onClick(long itemId)
Dispatches click on a specific item.
|
boolean |
onLongClick(long itemId)
Dispatches long click on a specific item.
|
void |
onSaveInstanceState(Bundle outState)
Call this method to retrieve per-instance state before UI component being killed
so that the state can be restored via constructor.
|
boolean |
requiresLongpress()
Returns whether long press is required by this choice mode.
|
boolean |
requiresStableIds()
Returns whether stable item ids are required by this choice mode.
|
void |
setChoiceModeListener(SimpleChoiceModeListener listener)
Sets multiple choice mode callback.
|
void |
setItemChecked(long itemId,
boolean checked)
Sets the checked state of the specified position.
|
isAttached, notifyAllItemsCheckedChanged, notifyItemCheckedChanged, registerChoiceModeObserver, unregisterChoiceModeObserverpublic void setChoiceModeListener(@Nullable SimpleChoiceModeListener listener)
public boolean requiresStableIds()
public boolean requiresLongpress()
public boolean isActivated()
public int getCheckedItemCount()
To determine the specific items that are currently selected, use one of
the getChecked* methods.
public boolean isItemChecked(long itemId)
itemId - The item whose checked state to return.false.public void setItemChecked(long itemId,
boolean checked)
ChoiceModeitemId - The item id whose checked state is to be checked.checked - The new checked state for the item.@NonNull public LongArrayList getCheckedItems()
LongArrayList of checked item ids.
Don't modify it without copying.public void clearChoices()
public boolean onClick(long itemId)
ChoiceModeitemId - The item id which has been clicked.public boolean onLongClick(long itemId)
ChoiceModeitemId - The item id which has been clicked.