public final class NoneChoiceMode extends Object implements ChoiceMode
ChoiceMode that does not have any choice behavior.
It is a default adapter's choice mode.| Constructor and Description |
|---|
NoneChoiceMode() |
| Modifier and Type | Method and Description |
|---|---|
void |
clearChoices()
Clears any checked items.
|
int |
getCheckedItemCount()
Returns the number of items currently selected.
|
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 |
registerChoiceModeObserver(ChoiceModeObserver observer)
Register a new observer to listen for selection changes.
|
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 |
setItemChecked(long itemId,
boolean checked)
Sets the checked state of the specified position.
|
void |
unregisterChoiceModeObserver(ChoiceModeObserver observer)
Unregister an observer currently listening for selection changes.
|
public boolean requiresStableIds()
requiresStableIds in interface ChoiceModepublic boolean requiresLongpress()
requiresLongpress in interface ChoiceModepublic boolean isActivated()
isActivated in interface ChoiceModepublic int getCheckedItemCount()
To determine the specific items that are currently selected, use one of
the getChecked* methods.
getCheckedItemCount in interface ChoiceModepublic boolean isItemChecked(long itemId)
isItemChecked in interface ChoiceModeitemId - The item whose checked state to return.false.public void setItemChecked(long itemId,
boolean checked)
setItemChecked in interface ChoiceModeitemId - The item id whose checked state is to be checked.checked - The new checked state for the item.public void clearChoices()
clearChoices in interface ChoiceModepublic boolean onClick(long itemId)
onClick in interface ChoiceModeitemId - The item id which has been clicked.public boolean onLongClick(long itemId)
onLongClick in interface ChoiceModeitemId - The item id which has been clicked.public void registerChoiceModeObserver(@NonNull ChoiceModeObserver observer)
The choice mode may publish a variety of events describing selection changes.
Components registering observers with a choice mode are responsible for
ChoiceMode.unregisterChoiceModeObserver(ChoiceModeObserver)
unregistering} those observers when finished.
registerChoiceModeObserver in interface ChoiceModeobserver - Observer to register.ChoiceMode.unregisterChoiceModeObserver(ChoiceModeObserver)public void unregisterChoiceModeObserver(@NonNull ChoiceModeObserver observer)
The unregistered observer will no longer receive events about changes to the choice mode.
unregisterChoiceModeObserver in interface ChoiceModeobserver - Observer to unregister.ChoiceMode.registerChoiceModeObserver(ChoiceModeObserver)