# RecyclerViewAccessibilityDelegate.ItemDelegate

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

*** ** * ** ***


```
public class RecyclerViewAccessibilityDelegate.ItemDelegate extends AccessibilityDelegateCompat
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.core.view.AccessibilityDelegateCompat](https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat) ||
|   | ↳ | [androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate.ItemDelegate](https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate) |

*** ** * ** ***

The default implementation of accessibility delegate for the individual items of the RecyclerView.

If you are overriding `RecyclerViewAccessibilityDelegate#getItemDelegate()` but still want to keep some default behavior, you can create an instance of this class and delegate to the parent as necessary.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#ItemDelegate(androidx.recyclerview.widget.RecyclerViewAccessibilityDelegate)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate recyclerViewDelegate )` Creates an item delegate for the given `RecyclerViewAccessibilityDelegate`. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#dispatchPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Dispatches an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` to the host `https://developer.android.com/reference/android/view/View.html` first and then to its children for adding their text content to the event. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeProviderCompat` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#getAccessibilityNodeProvider(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host)` Gets the provider for managing a virtual view hierarchy rooted at this View and reported to `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html`s that explore the window content. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Initializes an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` with information about the the host View which is the event source. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat info )` Initializes an `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat` with information about the host view. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#onPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Gives a chance to the host View to populate the accessibility event with its text content. |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#onRequestSendAccessibilityEvent(android.view.ViewGroup,android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ViewGroup.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html child, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Called when a child of the host View has requested sending an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` and gives an opportunity to the parent (the host) to augment the event. |
| `boolean` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#performAccessibilityAction(android.view.View,int,android.os.Bundle)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, int action, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html args )` Performs the specified accessibility action on the view. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#sendAccessibilityEvent(android.view.View,int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, int eventType)` Sends an accessibility event of the given type. |
| `void` | `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate.ItemDelegate#sendAccessibilityEventUnchecked(android.view.View,android.view.accessibility.AccessibilityEvent)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event )` Sends an accessibility event. |

## Public constructors

### ItemDelegate

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

```
public ItemDelegate(
    @NonNull RecyclerViewAccessibilityDelegate recyclerViewDelegate
)
```

Creates an item delegate for the given `RecyclerViewAccessibilityDelegate`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerViewAccessibilityDelegate recyclerViewDelegate` | The parent RecyclerView's accessibility delegate. |

## Public methods

### dispatchPopulateAccessibilityEvent

```
public boolean dispatchPopulateAccessibilityEvent(
    @NonNull View host,
    @NonNull AccessibilityEvent event
)
```

Dispatches an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` to the host `https://developer.android.com/reference/android/view/View.html` first and then to its children for adding their text content to the event.

The default implementation behaves as `https://developer.android.com/reference/android/view/View.html#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The event. |

| Returns |
|---|---|
| `boolean` | True if the event population was completed. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent)` | View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) |

### getAccessibilityNodeProvider

```
public @Nullable AccessibilityNodeProviderCompat getAccessibilityNodeProvider(@NonNull View host)
```

Gets the provider for managing a virtual view hierarchy rooted at this View and reported to `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.html`s that explore the window content.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#getAccessibilityNodeProvider(android.view.View)` for the case of no accessibility delegate been set.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeProviderCompat` | The provider. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeProviderCompat` |   |

### onInitializeAccessibilityEvent

```
public void onInitializeAccessibilityEvent(
    @NonNull View host,
    @NonNull AccessibilityEvent event
)
```

Initializes an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` with information about the the host View which is the event source.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The event to initialize. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` | ViewCompat#onInitializeAccessibilityEvent(View, AccessibilityEvent) |

### onInitializeAccessibilityNodeInfo

```
public void onInitializeAccessibilityNodeInfo(
    @NonNull View host,
    @NonNull AccessibilityNodeInfoCompat info
)
```

Initializes an `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat` with information about the host view.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat info` | The instance to initialize. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewCompat#onInitializeAccessibilityNodeInfo(android.view.View,androidx.core.view.accessibility.AccessibilityNodeInfoCompat)` | ViewCompat#onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfoCompat) |

### onPopulateAccessibilityEvent

```
public void onPopulateAccessibilityEvent(
    @NonNull View host,
    @NonNull AccessibilityEvent event
)
```

Gives a chance to the host View to populate the accessibility event with its text content.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewCompat#onPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The accessibility event which to populate. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewCompat#onPopulateAccessibilityEvent(android.view.View,android.view.accessibility.AccessibilityEvent)` | ViewCompat#onPopulateAccessibilityEvent(View, AccessibilityEvent) |

### onRequestSendAccessibilityEvent

```
public boolean onRequestSendAccessibilityEvent(
    @NonNull ViewGroup host,
    @NonNull View child,
    @NonNull AccessibilityEvent event
)
```

Called when a child of the host View has requested sending an `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` and gives an opportunity to the parent (the host) to augment the event.

The default implementation behaves as `https://developer.android.com/reference/androidx/core/view/ViewGroupCompat#onRequestSendAccessibilityEvent(android.view.ViewGroup,android.view.View,android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/ViewGroup.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html child` | The child which requests sending the event. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The event to be sent. |

| Returns |
|---|---|
| `boolean` | True if the event should be sent |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/view/ViewGroupCompat#onRequestSendAccessibilityEvent(android.view.ViewGroup,android.view.View,android.view.accessibility.AccessibilityEvent)` | ViewGroupCompat#onRequestSendAccessibilityEvent(ViewGroup, View, AccessibilityEvent) |

### performAccessibilityAction

```
public boolean performAccessibilityAction(
    @NonNull View host,
    int action,
    @Nullable Bundle args
)
```

Performs the specified accessibility action on the view. For possible accessibility actions look at `https://developer.android.com/reference/androidx/core/view/accessibility/AccessibilityNodeInfoCompat`.

The default implementation behaves as `https://developer.android.com/reference/android/view/View.html#performAccessibilityAction(int, android.os.Bundle)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | View on which to perform the action. |
| `int action` | The action to perform. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html args` | Optional action arguments. |

| Returns |
|---|---|
| `boolean` | Whether the action was performed. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#performAccessibilityAction(int, android.os.Bundle)` | View#performAccessibilityAction(int, Bundle) |

### sendAccessibilityEvent

```
public void sendAccessibilityEvent(@NonNull View host, int eventType)
```

Sends an accessibility event of the given type. If accessibility is not enabled this method has no effect.

The default implementation behaves as `https://developer.android.com/reference/android/view/View.html#sendAccessibilityEvent(int)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `int eventType` | The type of the event to send. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#sendAccessibilityEvent(int)` | View#sendAccessibilityEvent(int) |

### sendAccessibilityEventUnchecked

```
public void sendAccessibilityEventUnchecked(
    @NonNull View host,
    @NonNull AccessibilityEvent event
)
```

Sends an accessibility event. This method behaves exactly as `https://developer.android.com/reference/androidx/core/view/AccessibilityDelegateCompat#sendAccessibilityEvent(android.view.View,int)` but takes as an argument an empty `https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html` and does not perform a check whether accessibility is enabled.

The default implementation behaves as `https://developer.android.com/reference/android/view/View.html#sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent)` for the case of no accessibility delegate been set.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html host` | The View hosting the delegate. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html event` | The event to send. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent)` | View#sendAccessibilityEventUnchecked(AccessibilityEvent) |