> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Customize an InstantSearch Android widget

> Learn how you can customize an existing InstantSearch Android widget.

With InstantSearch Android, you are in control of every widget's UI. Each widget is represented by an interface, for which Algolia provides default implementations. If these implementations don't fit your purpose, you can either customize the existing implementation, or create your own.

## Customize the existing implementation

All InstantSearch widgets are built through composition. This enables you to adapt the underlying `View` and add the behavior you want **on top of the existing implementation**.

For example, here's how you can have a `SearchBoxViewImpl` that always displays its content uppercase:

```kotlin Kotlin theme={"system"}
  val searchBoxView = SearchBoxViewImpl(SearchView(context))
  searchBoxView.searchView.inputType = InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
```

## Implement your own view

When you want to **replace the existing behavior** of a default implementation, you should implement your own `View`.

### Example

Here is a custom SearchBoxView

```kotlin Kotlin theme={"system"}
public class SearchBoxViewEditText(
  public val editText: EditText
) : SearchBoxView {

  override var onQueryChanged: ((String?) -> Unit)? = null
  override var onQuerySubmitted: ((String?) -> Unit)? = null

  init {
      editText.addTextChangedListener(object : TextWatcher {

          override fun afterTextChanged(s: Editable?) = Unit

          override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit

          override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
              onQueryChanged?.invoke(s?.toString())
          }
      })
  }

  override fun setItem(item: String?) {
      editText.setText(item)
  }
}
```
