Added in API level 19

Builder


class Builder
kotlin.Any
   ↳ android.print.PrinterInfo.Builder

Builder for creating of a PrinterInfo.

Summary

Public constructors
Builder(printerId: PrinterId, name: String, status: Int)

Constructor.

Constructor.

Public methods
PrinterInfo

Creates a new PrinterInfo.

PrinterInfo.Builder

Sets the printer capabilities.

PrinterInfo.Builder
setDescription(description: String)

Sets the localized printer description which is shown to the user

PrinterInfo.Builder
setHasCustomPrinterIcon(hasCustomPrinterIcon: Boolean)

Declares that the print service can load a custom per printer's icon.

PrinterInfo.Builder
setIconResourceId(iconResourceId: Int)

Set a drawable resource as icon for this printer.

PrinterInfo.Builder

Sets the PendingIntent that launches an activity showing more information about the printer.

PrinterInfo.Builder
setName(name: String)

Sets the localized printer name which is shown to the user

PrinterInfo.Builder
setStatus(status: Int)

Sets the printer status.

Public constructors

Builder

Added in API level 19
Builder(
    printerId: PrinterId,
    name: String,
    status: Int)

Constructor.

Parameters
printerId PrinterId: The printer id. Cannot be null.
name String: The printer name. Cannot be empty. This value cannot be null.
status Int: The printer status. Must be a valid status. Value is android.print.PrinterInfo#STATUS_IDLE, android.print.PrinterInfo#STATUS_BUSY, or android.print.PrinterInfo#STATUS_UNAVAILABLE
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
Builder(other: PrinterInfo)

Constructor.

Parameters
other PrinterInfo: Other info from which to start building. This value cannot be null.

Public methods

build

Added in API level 19
fun build(): PrinterInfo

Creates a new PrinterInfo.

Return
PrinterInfo A new PrinterInfo. This value cannot be null.

setCapabilities

Added in API level 19
fun setCapabilities(capabilities: PrinterCapabilitiesInfo): PrinterInfo.Builder

Sets the printer capabilities.

Parameters
capabilities PrinterCapabilitiesInfo: The capabilities. This value cannot be null.
Return
PrinterInfo.Builder This builder. This value cannot be null.

setDescription

Added in API level 19
fun setDescription(description: String): PrinterInfo.Builder

Sets the localized printer description which is shown to the user

Parameters
description String: The description. This value cannot be null.
Return
PrinterInfo.Builder This builder. This value cannot be null.

setHasCustomPrinterIcon

Added in API level 24
fun setHasCustomPrinterIcon(hasCustomPrinterIcon: Boolean): PrinterInfo.Builder

Declares that the print service can load a custom per printer's icon. If both PrinterInfo.Builder#setIconResourceId 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 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.

Parameters
hasCustomPrinterIcon Boolean: If the printer has a custom icon or not.
Return
PrinterInfo.Builder This builder. This value cannot be null.

setIconResourceId

Added in API level 24
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: The resource ID of the icon.
Return
PrinterInfo.Builder This builder. This value cannot be null.

setInfoIntent

Added in API level 24
fun setInfoIntent(infoIntent: PendingIntent): PrinterInfo.Builder

Sets the PendingIntent that launches an activity showing more information about the printer.

Parameters
infoIntent PendingIntent: The intent. This value cannot be null.
Return
PrinterInfo.Builder This builder. This value cannot be null.

setName

Added in API level 19
fun setName(name: String): PrinterInfo.Builder

Sets the localized printer name which is shown to the user

Parameters
name String: The name. This value cannot be null.
Return
PrinterInfo.Builder This builder. This value cannot be null.