# WalletCard.Builder

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#inhmethods)  

# WalletCard.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/service/quickaccesswallet/WalletCard.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
WalletCard.Builder
`  
`

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


``


`

|---|------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.service.quickaccesswallet.WalletCard.Builder |

<br />

*** ** * ** ***

Builder for[WalletCard](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard)objects. You must provide cardId, cardImage, contentDescription, and pendingIntent. If the card is opaque and should be shown with elevation, set hasShadow to true. cardIcon and cardLabel are optional.

## Summary

|                                                                                                                                                                                                                                                                                                                                            ### Public constructors                                                                                                                                                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#Builder(java.lang.String,%20android.graphics.drawable.Icon,%20java.lang.CharSequence,%20android.app.PendingIntent))`(`[String](https://developer.android.com/reference/java/lang/String)` cardId, `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` cardImage, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` contentDescription, `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent)` pendingIntent) ` Called when a card type is not provided, in which case it defaults to CARD_TYPE_UNKNOWN. |
| ` `[Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#Builder(java.lang.String,%20int,%20android.graphics.drawable.Icon,%20java.lang.CharSequence,%20android.app.PendingIntent))`(`[String](https://developer.android.com/reference/java/lang/String)` cardId, int cardType, `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` cardImage, `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` contentDescription, `[PendingIntent](https://developer.android.com/reference/android/app/PendingIntent)` pendingIntent) `                                                                     |

|                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                ||
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[WalletCard](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard)                 | ` `[build](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#build())`() ` Builds a new[WalletCard](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard)instance.                                                                                                                                                                             |
| ` `[WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | ` `[setCardIcon](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#setCardIcon(android.graphics.drawable.Icon))`(`[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` cardIcon) ` An icon may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. |
| ` `[WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | ` `[setCardLabel](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#setCardLabel(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` cardLabel) ` A card label may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. |
| ` `[WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | ` `[setCardLocations](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#setCardLocations(java.util.List<android.location.Location>))`(`[List](https://developer.android.com/reference/java/util/List)`<`[Location](https://developer.android.com/reference/android/location/Location)`> cardLocations) ` Set of locations this card might be useful at.                        |
| ` `[WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | ` `[setNonPaymentCardSecondaryImage](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#setNonPaymentCardSecondaryImage(android.graphics.drawable.Icon))`(`[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)` nonPaymentCardSecondaryImage) ` Visual representation of the card when it is tapped.                                                 |

| ### Inherited methods |
|-----------------------|---|
| 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,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

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

```
public Builder (String cardId, 
                Icon cardImage, 
                CharSequence contentDescription, 
                PendingIntent pendingIntent)
```

Called when a card type is not provided, in which case it defaults to CARD_TYPE_UNKNOWN. Calls[Builder.Builder(String, int, Icon, CharSequence, PendingIntent)](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder#Builder(java.lang.String,%20int,%20android.graphics.drawable.Icon,%20java.lang.CharSequence,%20android.app.PendingIntent))

<br />

|                                Parameters                                 ||
|----------------------|-----------------------------------------------------|
| `cardId`             | `String`: This value cannot be`null`. <br />        |
| `cardImage`          | `Icon`: This value cannot be`null`. <br />          |
| `contentDescription` | `CharSequence`: This value cannot be`null`. <br />  |
| `pendingIntent`      | `PendingIntent`: This value cannot be`null`. <br /> |

### Builder

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

```
public Builder (String cardId, 
                int cardType, 
                Icon cardImage, 
                CharSequence contentDescription, 
                PendingIntent pendingIntent)
```

<br />

<br />

|                                                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                                                              ||
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cardId`             | `String`: The card id must be non-null and unique within the list of cards returned.**Note:** this card ID should**not** contain PII (Personally Identifiable Information, such as username or email address). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `cardType`           | `int`: Integer representing the card type. The card type must be non-null. Value is[WalletCard.CARD_TYPE_UNKNOWN](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard#CARD_TYPE_UNKNOWN),[WalletCard.CARD_TYPE_PAYMENT](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard#CARD_TYPE_PAYMENT), or[WalletCard.CARD_TYPE_NON_PAYMENT](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard#CARD_TYPE_NON_PAYMENT) <br />                                                                                                                                                                                                                                                     |
| `cardImage`          | `Icon`: The visual representation of the card. If the card image Icon is a bitmap, it should have a width of[GetWalletCardsRequest.getCardWidthPx()](https://developer.android.com/reference/android/service/quickaccesswallet/GetWalletCardsRequest#getCardWidthPx())and a height of[GetWalletCardsRequest.getCardHeightPx()](https://developer.android.com/reference/android/service/quickaccesswallet/GetWalletCardsRequest#getCardHeightPx()). If the card image does not have these dimensions, it may appear distorted when it is scaled to fit these dimensions on screen. Bitmaps must be of type[Bitmap.Config.HARDWARE](https://developer.android.com/reference/android/graphics/Bitmap.Config#HARDWARE)for performance reasons. This value cannot be`null`. <br /> |
| `contentDescription` | `CharSequence`: The content description of the card image. This field is required and may not be null or empty.**Note:** this message should**not** contain PII (Personally Identifiable Information, such as username or email address). <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `pendingIntent`      | `PendingIntent`: If the user performs a click on the card, this PendingIntent will be sent. If the device is locked, the wallet will first request device unlock before sending the pending intent. It is recommended that the pending intent be immutable (use[PendingIntent.FLAG_IMMUTABLE](https://developer.android.com/reference/android/app/PendingIntent#FLAG_IMMUTABLE)). This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                          |

## Public methods

### build

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

```
public WalletCard build ()
```

Builds a new[WalletCard](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard)instance.

<br />

|                                                                         Returns                                                                          ||
|----------------------------------------------------------------------------------------------------|------------------------------------------------------|
| [WalletCard](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard) | A built response. This value cannot be`null`. <br /> |

### setCardIcon

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

```
public WalletCard.Builder setCardIcon (Icon cardIcon)
```

An icon may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. For example, an NFC logo could indicate that the card is NFC-enabled and will be provided to an NFC terminal if the phone is held in close proximity to the NFC reader. This field is optional.

If the supplied Icon is backed by a bitmap, it should have width and height[GetWalletCardsRequest.getIconSizePx()](https://developer.android.com/reference/android/service/quickaccesswallet/GetWalletCardsRequest#getIconSizePx()).

<br />

|                     Parameters                      ||
|------------|-----------------------------------------|
| `cardIcon` | `Icon`: This value may be`null`. <br /> |

|                                                                        Returns                                                                         ||
|--------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | This value cannot be`null`. <br /> |

### setCardLabel

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

```
public WalletCard.Builder setCardLabel (CharSequence cardLabel)
```

A card label may be shown alongside the card image to convey information about how the card can be used, or if some other action must be taken before using the card. For example, an NFC-enabled card could be labeled "Hold near reader" to inform the user of how to use NFC cards when interacting with an NFC reader. This field is optional.**Note:** this card label should**not**contain PII (Personally Identifiable Information, such as username or email address). If the provided label is too long to fit on one line, it may be truncated and ellipsized.

<br />

|                          Parameters                          ||
|-------------|-------------------------------------------------|
| `cardLabel` | `CharSequence`: This value may be`null`. <br /> |

|                                                                        Returns                                                                         ||
|--------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | This value cannot be`null`. <br /> |

### setCardLocations

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

```
public WalletCard.Builder setCardLocations (List<Location> cardLocations)
```

Set of locations this card might be useful at. If[PackageManager.FEATURE_WALLET_LOCATION_BASED_SUGGESTIONS](https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_WALLET_LOCATION_BASED_SUGGESTIONS)is enabled, the card might be shown to the user when a user is near one of these locations.

<br />

|                         Parameters                          ||
|-----------------|--------------------------------------------|
| `cardLocations` | `List`: This value cannot be`null`. <br /> |

|                                                                        Returns                                                                         ||
|--------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | This value cannot be`null`. <br /> |

### setNonPaymentCardSecondaryImage

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

```
public WalletCard.Builder setNonPaymentCardSecondaryImage (Icon nonPaymentCardSecondaryImage)
```

Visual representation of the card when it is tapped. May include additional information unique to the card, such as a barcode or number. Only valid for CARD_TYPE_NON_PAYMENT.

<br />

|                               Parameters                                ||
|--------------------------------|-----------------------------------------|
| `nonPaymentCardSecondaryImage` | `Icon`: This value may be`null`. <br /> |

|                                                                        Returns                                                                         ||
|--------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [WalletCard.Builder](https://developer.android.com/reference/android/service/quickaccesswallet/WalletCard.Builder) | This value cannot be`null`. <br /> |