# Card

extends [Object](https://d.android.com/reference/java/lang/Object.html)

|     |     |
| --- | --- |
| [java.lang.Object](https://d.android.com/reference/java/lang/Object.html) |
| ↳ | com.usebutton.sdk.purchasepath.Card |

|     |     |
| --- | --- |
|  Known Direct Subclasses

[TextCard](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/TextCard.html)

## Class Overview

Base template class for checkout extension overlay cards.

## Summary

### Constants

| Constants |
| --- |
| float | [DEFAULT_TEXT_SIZE_BODY](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#DEFAULT_TEXT_SIZE_BODY) |  |
| float | [DEFAULT_TEXT_SIZE_TITLE](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#DEFAULT_TEXT_SIZE_TITLE) |  |

### Public Constructors

| Public Constructors |
| --- |
|  | [Card](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#Card(com.usebutton.sdk.purchasepath.CallToAction))( [CallToAction](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/CallToAction.html) callToAction)<br> <br> <br>Creates a new card instance with the given call to action. |

### Public Methods

| Public Methods |
| --- |
| final<br> <br> <br> void | [bindView](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#bindView(View))(View view)<br> <br> <br>Invoked by the checkout system when a view should be populated with the card data. |
| final<br> <br> <br> View | [createView](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#createView(ViewGroup))(ViewGroup parent)<br> <br> <br>Invoked by the checkout system when a new view is needed to display card contents. |
| boolean | [equals](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#equals(java.lang.Object))( [Object](https://d.android.com/reference/java/lang/Object.html) obj) |
| final<br> <br> <br> [BrowserInterface](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/BrowserInterface.html) | [getBrowser](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#getBrowser())()<br> <br> <br>A reference to the checkout interface. |
| [CallToAction](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/CallToAction.html) | [getCallToAction](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#getCallToAction())()<br> <br> <br>Get the public call to action for the active state. |
| [Object](https://d.android.com/reference/java/lang/Object.html) | [getKey](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#getKey())()<br> <br> <br>Gets the key of this card. |
| final<br> <br> <br> View | [getView](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#getView())()<br> <br> <br>The view instance currently associated with this card. |
| int | [hashCode](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#hashCode())() |
| final<br> <br> <br> void | [setBrowser](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#setBrowser(com.usebutton.sdk.purchasepath.BrowserInterface))( [BrowserInterface](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/BrowserInterface.html) browser) |
| void | [setKey](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#setKey(java.lang.Object))( [Object](https://d.android.com/reference/java/lang/Object.html) key)<br> <br> <br>Sets the key of the card. |

### Protected Methods

| Protected Methods |
| --- |
| abstract<br> <br> <br> <br> <br> void | [onBindView](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#onBindView(View))(View view)<br> <br> <br>Called when an inflated card view should be populated with data for display. |
| abstract<br> <br> <br> <br> <br> View | [onCreateView](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/Card.html#onCreateView(ViewGroup))(ViewGroup parent)<br> <br> <br>Called when a view should be inflated to display the card contents. |

### Constants

#### public   static   final   float    DEFAULT_TEXT_SIZE_BODY

Constant Value:

13.0

#### public   static   final   float    DEFAULT_TEXT_SIZE_TITLE

Constant Value:

16.0

### Public Constructors

#### public             Card( [CallToAction](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/CallToAction.html) callToAction)

Creates a new card instance with the given call to action.

##### Parameters

| callToAction | call to action that will be displayed when the card is "active". |

### Public Methods

#### public     final       void  bindView(View view)

Invoked by the checkout system when a view should be populated with the card data. Delegates to `onBindView(View)` and performs other internal initialization.

##### Parameters

| view | a view instance inflated by `onCreateView(ViewGroup)` to display the card<br> contents. |

#### public     final       View  createView(ViewGroup parent)

Invoked by the checkout system when a new view is needed to display card contents. Delegates to `onCreateView(ViewGroup)` and performs other internal initialization.

##### Parameters

| parent | `ViewGroup` where newly inflated view should be attached. |

##### Returns
- the view inflated by ``.

#### public           boolean  equals( [Object](https://d.android.com/reference/java/lang/Object.html) obj)

#### public     final       [BrowserInterface](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/BrowserInterface.html)getBrowser()

A reference to the checkout interface.

Use this, for example, to make any changes to the top or bottom bars,
add, update, or remove cards when a user interacts with a card instance.

##### Returns
- Nullable value of `BrowserInterface`

#### public           [CallToAction](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/CallToAction.html)getCallToAction()

Get the public call to action for the active state.

##### Returns
- the call to action for this card.

#### public           [Object](https://d.android.com/reference/java/lang/Object.html)getKey()

Gets the key of this card.

##### Returns
- key object.

#### public     final       View  getView()

The view instance currently associated with this card.
Use this to make any updates to your view, for example, when a user interacts with the view.

##### Returns
- Nullable value when a card instance has an associated view representing it

#### public           int  hashCode()

#### public     final       void  setBrowser( [BrowserInterface](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/purchasepath/BrowserInterface.html) browser)

#### public           void  setKey( [Object](https://d.android.com/reference/java/lang/Object.html) key)

Sets the key of the card.

Keys are meant to be unique. If multiple cards match the given key, There can be issue trying
to get the correct card from the `CardList`

##### Parameters

| key | Object. |

### Protected Methods

#### protected       abstract     void  onBindView(View view)

Called when an inflated card view should be populated with data for display.

##### Parameters

| view | instance of the view returned from `onCreateView(ViewGroup)` |

#### protected       abstract     View  onCreateView(ViewGroup parent)

Called when a view should be inflated to display the card contents. Subclasses should
override this method

##### Parameters

| parent | `ViewGroup` where newly inflated view should be attached. |

##### Returns
- the newly inflated view that can display the card contents.
