# SearchSupportFragment.SearchResultProvider

# SearchSupportFragment.SearchResultProvider

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/app/SearchSupportFragment.java+class:androidx.leanback.app.SearchSupportFragment.SearchResultProvider)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/app/SearchSupportFragment.SearchResultProvider "View this page in Java")

<br />

```
interface SearchSupportFragment.SearchResultProvider
```

<br />

*** ** * ** ***

Search API to be provided by the application.

## Summary

|                                           ### Public functions                                            |
|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter)`!` | [getResultsAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/app/SearchSupportFragment.SearchResultProvider#getResultsAdapter())`()` Method invoked some time prior to the first call to onQueryTextChange to retrieve an ObjectAdapter that will contain the results to future updates of the search query.                                                                                                                   |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                       | [onQueryTextChange](https://developer.android.com/reference/kotlin/androidx/leanback/app/SearchSupportFragment.SearchResultProvider#onQueryTextChange(java.lang.String))`(newQuery: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Method invoked when the search query is updated.                                                                                                                            |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                       | [onQueryTextSubmit](https://developer.android.com/reference/kotlin/androidx/leanback/app/SearchSupportFragment.SearchResultProvider#onQueryTextSubmit(java.lang.String))`(query: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Method invoked when the search query is submitted, either by dismissing the keyboard, pressing search or next on the keyboard or when voice has detected the end of the query. |

## Public functions

### getResultsAdapter

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

```
fun getResultsAdapter(): ObjectAdapter!
```

Method invoked some time prior to the first call to onQueryTextChange to retrieve an ObjectAdapter that will contain the results to future updates of the search query.

As results are retrieved, the application should use the data set notification methods on the ObjectAdapter to instruct the SearchSupportFragment to update the results.  

|                                                  Returns                                                  |
|-----------------------------------------------------------------------------------------------------------|------------------------------------------|
| [ObjectAdapter](https://developer.android.com/reference/kotlin/androidx/leanback/widget/ObjectAdapter)`!` | ObjectAdapter The result object adapter. |

### onQueryTextChange

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

```
fun onQueryTextChange(newQuery: String!): Boolean
```

Method invoked when the search query is updated.

This is called as soon as the query changes; it is up to the application to add a delay before actually executing the queries if needed.

This method might not always be called before onQueryTextSubmit gets called, in particular for voice input.  

|                                            Parameters                                            |
|--------------------------------------------------------------------------------------------------|---------------------------|
| `newQuery: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The current search query. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the results changed as a result of the new query. |

### onQueryTextSubmit

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

```
fun onQueryTextSubmit(query: String!): Boolean
```

Method invoked when the search query is submitted, either by dismissing the keyboard, pressing search or next on the keyboard or when voice has detected the end of the query.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|--------------------|
| `query: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The query entered. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|-------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | whether the results changed as a result of the query. |