# PrinterInfo.Builder

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/print/PrinterInfo.Builder "View this page in Java")  

```
class Builder
```

|---|------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                         ||
| ↳ | [android.print.PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) |

Builder for creating of a[PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo).

## Summary

|                                                                                                                                                                                                                          Public constructors                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#Builder(android.print.PrinterId,%20kotlin.String,%20kotlin.Int))`(`printerId:` `[PrinterId](https://developer.android.com/reference/kotlin/android/print/PrinterId)`, `name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `status:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Constructor. |
| [Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#Builder(android.print.PrinterInfo))`(`other:` `[PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo)`)` Constructor.                                                                                                                                                                                                                  |

|                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo)                  | [build](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#build())`()` Creates a new[PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo).                                                                                                                                                                                                                                |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setCapabilities](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setCapabilities(android.print.PrinterCapabilitiesInfo))`(`capabilities:` `[PrinterCapabilitiesInfo](https://developer.android.com/reference/kotlin/android/print/PrinterCapabilitiesInfo)`)` Sets the printer capabilities.                                                                                                             |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setDescription](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setDescription(kotlin.String))`(`description:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets the**localized**printer description which is shown to the user                                                                                                                                  |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setHasCustomPrinterIcon](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setHasCustomPrinterIcon(kotlin.Boolean))`(`hasCustomPrinterIcon:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Declares that the print service can load a custom per printer's icon.                                                                                                  |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setIconResourceId](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setIconResourceId(kotlin.Int))`(`iconResourceId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Set a drawable resource as icon for this printer.                                                                                                                                                    |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setInfoIntent](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setInfoIntent(android.app.PendingIntent))`(`infoIntent:` `[PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#)`)` Sets the[PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#)that launches an activity showing more information about the printer. |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setName](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setName(kotlin.String))`(`name:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Sets the**localized**printer name which is shown to the user                                                                                                                                                              |
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | [setStatus](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setStatus(kotlin.Int))`(`status:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the printer status.                                                                                                                                                                                                     |

## Public constructors

### Builder

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(
    printerId: PrinterId, 
    name: String, 
    status: Int)
```

Constructor.

|                                                                                                                                                                                                                                                                                       Parameters                                                                                                                                                                                                                                                                                        ||
|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `printerId` | [PrinterId](https://developer.android.com/reference/kotlin/android/print/PrinterId):The printer id. Cannot be null.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `name`      | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The printer name. Cannot be empty. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `status`    | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The printer status. Must be a valid status. Value is[android.print.PrinterInfo#STATUS_IDLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_IDLE:kotlin.Int),[android.print.PrinterInfo#STATUS_BUSY](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_BUSY:kotlin.Int), or[android.print.PrinterInfo#STATUS_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_UNAVAILABLE:kotlin.Int) |

|                                                           Exceptions                                                            ||
|--------------------------------------|-------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | If the printer id is null, or the printer name is empty or the status is not a valid one. |

### Builder

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Builder(other: PrinterInfo)
```

Constructor.

|                                                                              Parameters                                                                               ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `other` | [PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo):Other info from which to start building. This value cannot be`null`. |

## Public methods

### build

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun build(): PrinterInfo
```

Creates a new[PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo).

|                                                                                                       Return                                                                                                       ||
|-----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo) | A new[PrinterInfo](https://developer.android.com/reference/kotlin/android/print/PrinterInfo). This value cannot be`null`. |

### setCapabilities

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setCapabilities(capabilities: PrinterCapabilitiesInfo): PrinterInfo.Builder
```

Sets the printer capabilities.

|                                                                                  Parameters                                                                                   ||
|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `capabilities` | [PrinterCapabilitiesInfo](https://developer.android.com/reference/kotlin/android/print/PrinterCapabilitiesInfo):The capabilities. This value cannot be`null`. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

### setDescription

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setDescription(description: String): PrinterInfo.Builder
```

Sets the**localized**printer description which is shown to the user

|                                                                  Parameters                                                                  ||
|---------------|-------------------------------------------------------------------------------------------------------------------------------|
| `description` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The description. This value cannot be`null`. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

### setHasCustomPrinterIcon

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setHasCustomPrinterIcon(hasCustomPrinterIcon: Boolean): PrinterInfo.Builder
```

Declares that the print service can load a custom per printer's icon. If both[PrinterInfo.Builder.setIconResourceId](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setIconResourceId(kotlin.Int))and a custom icon are set the resource icon is shown while the custom icon loads but then the custom icon is used. If[PrinterInfo.Builder.setIconResourceId](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setIconResourceId(kotlin.Int))is not set the printer's service's icon is shown while loading.

The icon is requested asynchronously and only when needed via[android.printservice.PrinterDiscoverySession#onRequestCustomPrinterIcon](https://developer.android.com/reference/kotlin/android/printservice/PrinterDiscoverySession.html#onRequestCustomPrinterIcon(android.print.PrinterId,%20android.os.CancellationSignal,%20android.printservice.CustomPrinterIconCallback)).

|                                                                     Parameters                                                                      ||
|------------------------|-----------------------------------------------------------------------------------------------------------------------------|
| `hasCustomPrinterIcon` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):If the printer has a custom icon or not. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

### setIconResourceId

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setIconResourceId(iconResourceId: Int): PrinterInfo.Builder
```

Set a drawable resource as icon for this printer. If no icon is set the printer's service's icon is used for the printer.

|                                                        Parameters                                                         ||
|------------------|---------------------------------------------------------------------------------------------------------|
| `iconResourceId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The resource ID of the icon. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

**See Also**

- [android.print.PrinterInfo.Builder#setHasCustomPrinterIcon](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#setHasCustomPrinterIcon(kotlin.Boolean))  

### setInfoIntent

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setInfoIntent(infoIntent: PendingIntent): PrinterInfo.Builder
```

Sets the[PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#)that launches an activity showing more information about the printer.

|                                                                                                               Parameters                                                                                                               ||
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `infoIntent` | [PendingIntent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#):The[intent](https://developer.android.com/reference/kotlin/android/app/PendingIntent.html#). This value cannot be`null`. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

### setName

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setName(name: String): PrinterInfo.Builder
```

Sets the**localized**printer name which is shown to the user

|                                                           Parameters                                                           ||
|--------|------------------------------------------------------------------------------------------------------------------------|
| `name` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):The name. This value cannot be`null`. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

### setStatus

Added in[API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setStatus(status: Int): PrinterInfo.Builder
```

Sets the printer status.

|                                                                                                                                                                                                                                                                      Parameters                                                                                                                                                                                                                                                                      ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `status` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The status. Value is[android.print.PrinterInfo#STATUS_IDLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_IDLE:kotlin.Int),[android.print.PrinterInfo#STATUS_BUSY](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_BUSY:kotlin.Int), or[android.print.PrinterInfo#STATUS_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_UNAVAILABLE:kotlin.Int) |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------|-------------------------------------------|
| [PrinterInfo.Builder](https://developer.android.com/reference/kotlin/android/print/PrinterInfo.Builder#) | This builder. This value cannot be`null`. |

**See Also**

- [android.print.PrinterInfo#STATUS_IDLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_IDLE:kotlin.Int)
- [android.print.PrinterInfo#STATUS_BUSY](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_BUSY:kotlin.Int)
- [android.print.PrinterInfo#STATUS_UNAVAILABLE](https://developer.android.com/reference/kotlin/android/print/PrinterInfo#STATUS_UNAVAILABLE:kotlin.Int)