# InputDriver.Builder

Summary:[Ctors](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#pubctors)\|[Methods](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#)  

# InputDriver.Builder

`
public
static


class
InputDriver.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|----------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | com.google.android.things.userdriver.input.InputDriver.Builder |

<br />

*** ** * ** ***

Builder class for[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver)objects.

## Summary

|                                                                                 ### Public constructors                                                                                  ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#InputDriver.Builder())`() ` Constructs a new builder. |

|                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                     ||
|----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver)                 | ` `[build](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#build())`() ` Build an[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver).                                  |
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | ` `[setAxisConfiguration](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#setAxisConfiguration(int, int, int, int, int))`(int axis, int min, int max, int fuzz, int flat) ` Configure an absolute axis supported by this driver. |
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | ` `[setName](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#setName(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` Set the name of the input driver.                          |
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | ` `[setProductId](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#setProductId(int))`(int productId) ` Set the product id for the driver.                                                                                        |
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | ` `[setSupportedKeys](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#setSupportedKeys(int[]))`(int[] supportedKeyCodes) ` Set the keys supported by this driver.                                                                |
| ` `[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | ` `[setVendorId](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#setVendorId(int))`(int vendorId) ` Set the vendor id for the driver.                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                                                                                                                                                                                                                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                                                                                                                                                                                                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                                                                                                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                                                                                                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                                                                                                                                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long, int))`(long millis, int nanos) ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long millis) ` Causes the current thread to wait until either another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or a specified amount of time has elapsed.                                                                 | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object.                                                                                                                                  | ||

## Public constructors

### InputDriver.Builder

```
InputDriver.Builder ()
```

Constructs a new builder.

<br />

|                                                                        Returns                                                                        ||
|---|----------------------------------------------------------------------------------------------------------------------------------------------------|
|   | A new[InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder)instance. <br /> |

## Public methods

### build

```
InputDriver build ()
```

Build an[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver). Builds an[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver)with the provided characteristics.

<br />

|                                                                                                                     Returns                                                                                                                     ||
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
| [InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver) | A new[InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver)object. <br /> |

### setAxisConfiguration

```
InputDriver.Builder setAxisConfiguration (int axis, 
                int min, 
                int max, 
                int fuzz, 
                int flat)
```

Configure an absolute axis supported by this driver. This method should be called for each axis supported.

<br />

|                                                                                   Parameters                                                                                    ||
|--------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `axis` | `int`: One of the axis constants from[MotionEvent](https://developer.android.com/reference/android/view/MotionEvent.html). Currently only X and Y are supported. <br /> |
| `min`  | `int`: An inclusive minimum value of positions on this axis. <br />                                                                                                     |
| `max`  | `int`: An inclusive maximum value of positions on this axis. <br />                                                                                                     |
| `fuzz` | `int`: An int to denote the error tolerance of the axis measurements. <br />                                                                                            |
| `flat` | `int`: An int denoting the extent of the center flat position. <br />                                                                                                   |

|                                                                             Returns                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | The same builder instance. <br /> |

|                                                                        Throws                                                                        ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if \|axis\| is not supported or max \<= min. |

### setName

```
InputDriver.Builder setName (String name)
```

Set the name of the input driver.

<br />

|                                                          Parameters                                                           ||
|--------|-----------------------------------------------------------------------------------------------------------------------|
| `name` | `String`: A String representing the name of the driver. If a name is not provided, one will be auto-generated. <br /> |

|                                                                             Returns                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | The same builder instance. <br /> |

### setProductId

```
InputDriver.Builder setProductId (int productId)
```

Set the product id for the driver. A product id uniquely identifies which product within the address space of a given vendor, identified by the device's vendor id. A value of 0 will indicates a product id is not available.

<br />

|                                   Parameters                                    ||
|-------------|--------------------------------------------------------------------|
| `productId` | `int`: An int representing the input device. Defaults to 0. <br /> |

|                                                                             Returns                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | The same builder instance. <br /> |

### setSupportedKeys

```
InputDriver.Builder setSupportedKeys (int[] supportedKeyCodes)
```

Set the keys supported by this driver.

<br />

|                                                                                                       Parameters                                                                                                        ||
|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `supportedKeyCodes` | `int`: An array of key codes representing the keys this input driver supports. The codes must be values from[KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html). <br /> |

|                                                                             Returns                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | The same builder instance. <br /> |

|                                                                            Throws                                                                             ||
|--------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if any of the key codes are not recognized key codes. |

### setVendorId

```
InputDriver.Builder setVendorId (int vendorId)
```

Set the vendor id for the driver. A vendor id uniquely identifies the company who manufactured the device. A value of 0 indicates a vendor id is not available.

<br />

|                                  Parameters                                   ||
|------------|-------------------------------------------------------------------|
| `vendorId` | `int`: An int representing the vendor code. Defaults to 0. <br /> |

|                                                                             Returns                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------|
| [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder) | The same builder instance. <br /> |

-

  ## Classes

  - [InputDriver](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver)
  - [InputDriver.Builder](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriver.Builder)
  - [InputDriverEvent](https://developer.android.com/reference/com/google/android/things/userdriver/input/InputDriverEvent)