# InputSignInMethod.Builder

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/signin/InputSignInMethod.java+class:androidx.car.app.model.signin.InputSignInMethod.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***

Kotlin \|[Java](https://developer.android.com/reference/androidx/car/app/model/signin/InputSignInMethod.Builder "View this page in Java")


```
class InputSignInMethod.Builder
```

<br />

*** ** * ** ***

A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#Builder(androidx.car.app.model.InputCallback)(listener: https://developer.android.com/reference/kotlin/androidx/car/app/model/InputCallback)` Returns an `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` instance. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#build()()` Builds an `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod` instance. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setDefaultValue(java.lang.String)(defaultValue: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Sets the default value for this input. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setErrorMessage(java.lang.CharSequence)(message: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Sets the error message associated with this input box. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setHint(java.lang.CharSequence)(hint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)` Sets the text explaining to the user what should be entered in this input box. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setInputType(int)(inputType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the input type. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setKeyboardType(int)(keyboardType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Sets the keyboard type to display when this input box gets focused. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder#setShowKeyboardByDefault(boolean)(showKeyboardByDefault: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether keyboard should be opened by default when this template is presented. |

## Public constructors

### Builder

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

```
Builder(listener: InputCallback)
```

Returns an `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod.Builder` instance.

Note that the listener relates to UI events and will be executed on the main thread using `https://developer.android.com/reference/android/os/Looper.html#getMainLooper()`.

| Parameters |
|---|---|
| `listener: https://developer.android.com/reference/kotlin/androidx/car/app/model/InputCallback` | the `https://developer.android.com/reference/kotlin/androidx/car/app/model/InputCallbackDelegate` to be notified of input events |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `listener` is `null` |

## Public functions

### build

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

```
fun build(): InputSignInMethod
```

Builds an `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod` instance.

### setDefaultValue

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

```
fun setDefaultValue(defaultValue: String): InputSignInMethod.Builder
```

Sets the default value for this input.

Unless set with this method, the input box will not have a default value.

For `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#INPUT_TYPE_PASSWORD()` input types, in order to indicate that is not empty it is recommended to use a special value rather the actual credential. Any user input on a `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#INPUT_TYPE_PASSWORD()` input box will replace this default value instead of appending to it.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `defaultValue` is `null` |

### setErrorMessage

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

```
fun setErrorMessage(message: CharSequence): InputSignInMethod.Builder
```

Sets the error message associated with this input box.

For example, this can be used to indicate formatting errors, wrong username or password or any other problem related to the user input.

#### Requirements

Error messages can have only up to 2 lines of text, amd additional texts beyond the second line may be truncated.

Spans are not supported in the input string and will be ignored.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `message` is `null` |

### setHint

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

```
fun setHint(hint: CharSequence): InputSignInMethod.Builder
```

Sets the text explaining to the user what should be entered in this input box.

Unless set with this method, the sign-in method will not show any hint.

Spans are supported in the input string.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/NullPointerException.html` | if `hint` is `null` |

### setInputType

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

```
fun setInputType(inputType: Int): InputSignInMethod.Builder
```

Sets the input type.

This must be one of `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#INPUT_TYPE_DEFAULT()` or `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#INPUT_TYPE_PASSWORD()`

If not set, `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#INPUT_TYPE_DEFAULT()` will be assumed.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the provided input type is not supported |

### setKeyboardType

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

```
fun setKeyboardType(keyboardType: Int): InputSignInMethod.Builder
```

Sets the keyboard type to display when this input box gets focused.

This must be one of `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_DEFAULT()`, `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_PHONE()`, `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_NUMBER()`, or `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_EMAIL()`. A host might fall back to `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_DEFAULT()` if they do not support a particular keyboard type. If not provided, `https://developer.android.com/reference/kotlin/androidx/car/app/model/signin/InputSignInMethod#KEYBOARD_DEFAULT()` will be used.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the provided type is not supported |

### setShowKeyboardByDefault

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

```
fun setShowKeyboardByDefault(showKeyboardByDefault: Boolean): InputSignInMethod.Builder
```

Sets whether keyboard should be opened by default when this template is presented. By default, keyboard will only be opened if the user focuses on the input box.