# BandPredicate

# BandPredicate

Artifact:[androidx.recyclerview:recyclerview-selection](https://developer.android.com/jetpack/androidx/releases/recyclerview)  
[View Source](https://cs.android.com/search?q=file:androidx/recyclerview/selection/BandPredicate.java+class:androidx.recyclerview.selection.BandPredicate)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/recyclerview/selection/BandPredicate "View this page in Java")

<br />

```
abstract class BandPredicate
```

<br />

Known direct subclasses  
[BandPredicate.EmptyArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.EmptyArea),[BandPredicate.NonDraggableArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.NonDraggableArea)  

|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [BandPredicate.EmptyArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.EmptyArea)               | A BandPredicate that allows initiation of band selection only in areas of RecyclerView that map to[NO_POSITION](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION()).                                                                   |
| [BandPredicate.NonDraggableArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.NonDraggableArea) | A BandPredicate that allows initiation of band selection in any area that is not draggable as determined by consulting[inDragRegion](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/ItemDetailsLookup.ItemDetails#inDragRegion(android.view.MotionEvent)). |

*** ** * ** ***

Provides a means of controlling when and where band selection can be initiated.

Two default implementations are provided:[EmptyArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.EmptyArea), and[NonDraggableArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.NonDraggableArea).  

|                                                                                           See also                                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [withBandPredicate](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/SelectionTracker.Builder#withBandPredicate(androidx.recyclerview.selection.BandPredicate)) |   |

## Summary

|                                                                                                                                                                                                                                                                           ### Nested types                                                                                                                                                                                                                                                                           |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[BandPredicate.EmptyArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.EmptyArea)` : `[BandPredicate](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate) A BandPredicate that allows initiation of band selection only in areas of RecyclerView that map to[NO_POSITION](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION()).                                                                                 |
| `class `[BandPredicate.NonDraggableArea](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate.NonDraggableArea)` : `[BandPredicate](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate) A BandPredicate that allows initiation of band selection in any area that is not draggable as determined by consulting[inDragRegion](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/ItemDetailsLookup.ItemDetails#inDragRegion(android.view.MotionEvent)). |

|                                                      ### Public constructors                                                      |
|-----------------------------------------------------------------------------------------------------------------------------------|
| [BandPredicate](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate#BandPredicate())`()` |

|                                      ### Public functions                                      |
|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [canInitiate](https://developer.android.com/reference/kotlin/androidx/recyclerview/selection/BandPredicate#canInitiate(android.view.MotionEvent))`(e: `[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html)`)` |

## Public constructors

### BandPredicate

Added in 1.0.0  

```
BandPredicate()
```  

## Public functions

### canInitiate

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.0.0)  

```
abstract fun canInitiate(e: MotionEvent): Boolean
```  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | true if band selection can be initiated in response to the[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html). |