# OnChildSelectedListener

Artifact: [androidx.leanback:leanback-grid](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/widget/OnChildSelectedListener.java+class:androidx.leanback.widget.OnChildSelectedListener) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.0.0) Deprecated in [1.0.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.0.0)

*** ** * ** ***


```
public interface OnChildSelectedListener
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/leanback/widget/OnChildViewHolderSelectedListener`

Interface for receiving notification when a child of this ViewGroup has been selected.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `[onChildSelected](https://developer.android.com/reference/androidx/leanback/widget/OnChildSelectedListener#onChildSelected(android.view.ViewGroup,android.view.View,int,long))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/ViewGroup.html parent, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html view, int position, long id )` **This method is deprecated.** Deprecated in Java |

## Public methods

### onChildSelected

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

```
abstract void [onChildSelected](https://developer.android.com/reference/androidx/leanback/widget/OnChildSelectedListener#onChildSelected(android.view.ViewGroup,android.view.View,int,long))(
    @NonNull ViewGroup parent,
    @Nullable View view,
    int position,
    long id
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Callback method to be invoked when a child of this ViewGroup has been selected.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/view/ViewGroup.html parent` | The ViewGroup where the selection happened. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/view/View.html view` | The view within the ViewGroup that is selected, or null if no view is selected. |
| `int position` | The position of the view in the adapter, or NO_POSITION if no view is selected. |
| `long id` | The id of the child that is selected, or NO_ID if no view is selected. |