# WearableButtons

# WearableButtons

Artifact:[androidx.wear:wear-input](https://developer.android.com/jetpack/androidx/releases/wear)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/input/WearableButtons.java+class:androidx.wear.input.WearableButtons)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/input/WearableButtons "View this page in Java")

<br />

```
class WearableButtons
```

<br />

*** ** * ** ***

Class containing helpers for managing wearable buttons.

## Summary

|                                                                          ### Nested types                                                                           |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[WearableButtons.ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo) Metadata for a specific button. |

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_BOTTOM_CENTER](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_BOTTOM_CENTER())` = 107` Represents the center third of the bottom side on a square device. |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_BOTTOM_LEFT](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_BOTTOM_LEFT())` = 106` Represents the left third of the bottom side on a square device.       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_BOTTOM_RIGHT](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_BOTTOM_RIGHT())` = 108` Represents the right third of the bottom side on a square device.    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_EAST](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_EAST())` = 0` Represents the east position on a round device.                                        |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_ENE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_ENE())` = 1` Represents the east-northeast position on a round device.                                |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_ESE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_ESE())` = 15` Represents the east-southeast position on a round device.                               |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_LEFT_BOTTOM](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_LEFT_BOTTOM())` = 105` Represents the bottom third of the left side on a square device.       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_LEFT_CENTER](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_LEFT_CENTER())` = 104` Represents the center third of the left side on a square device.       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_LEFT_TOP](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_LEFT_TOP())` = 103` Represents the top third of the left side on a square device.                |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_NE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_NE())` = 2` Represents the northeast position on a round device.                                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_NNE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_NNE())` = 3` Represents the north-northeast position on a round device.                               |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_NNW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_NNW())` = 5` Represents the north-northwest position on a round device.                               |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_NORTH](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_NORTH())` = 4` Represents the north position on a round device.                                     |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_NW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_NW())` = 6` Represents the northwest position on a round device.                                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_RIGHT_BOTTOM](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_RIGHT_BOTTOM())` = 109` Represents the bottom third of the right side on a square device.    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_RIGHT_CENTER](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_RIGHT_CENTER())` = 110` Represents the center third of the right side on a square device.    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_RIGHT_TOP](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_RIGHT_TOP())` = 111` Represents the top third of the right side on a square device.             |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_SE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_SE())` = 14` Represents the southeast position on a round device.                                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_SOUTH](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_SOUTH())` = 12` Represents the south position on a round device.                                    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_SSE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_SSE())` = 13` Represents the south-southeast position on a round device.                              |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_SSW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_SSW())` = 11` Represents the south-southwest position on a round device.                              |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_SW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_SW())` = 10` Represents the southwest position on a round device.                                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_TOP_CENTER](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_TOP_CENTER())` = 101` Represents the center third of the top side on a square device.          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_TOP_LEFT](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_TOP_LEFT())` = 102` Represents the left third of the top side on a square device.                |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_TOP_RIGHT](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_TOP_RIGHT())` = 100` Represents the right third of the top side on a square device.             |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_UNKNOWN())` = -1` Represents that the location zone is unknown.                                   |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_WEST](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_WEST())` = 8` Represents the west position on a round device.                                        |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_WNW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_WNW())` = 7` Represents the west-northwest position on a round device.                                |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [LOCATION_WSW](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_WSW())` = 9` Represents the west-southwest position on a round device.                                |

|                                                             ### Public functions                                                             |
|----------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                    | [getButtonCount](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#getButtonCount(android.content.Context))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`)` Get the number of hardware buttons available.                                                                                                                                                                                                                                                                                                                                            |
| `java-static `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`?`                                 | [getButtonIcon](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#getButtonIcon(android.content.Context,int))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns an icon that can be used to represent the location of a button.                                                                                                                                                                                                                        |
| `java-static `[WearableButtons.ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo)`?` | [getButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#getButtonInfo(android.content.Context,int))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns a[ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo)containing the metadata for a specific button.                                                                                                                             |
| `java-static `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?`                              | [getButtonLabel](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#getButtonLabel(android.content.Context,int))`(context: `[Context](https://developer.android.com/reference/android/content/Context.html)`, keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Returns a CharSequence that describes the placement location of a button.                                                                                                                                                                                                                    |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                  | `@`[VisibleForTesting](https://developer.android.com/reference/kotlin/androidx/annotation/VisibleForTesting) [setWearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#setWearableButtonsProvider(androidx.wear.input.WearableButtonsProvider))`(provider: `[WearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtonsProvider)`)` Testing call to allow the underlying[WearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtonsProvider)to be substituted in test code. |

## Constants

### LOCATION_BOTTOM_CENTER

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_BOTTOM_CENTER = 107: Int
```

Represents the center third of the bottom side on a square device.  

### LOCATION_BOTTOM_LEFT

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_BOTTOM_LEFT = 106: Int
```

Represents the left third of the bottom side on a square device.  

### LOCATION_BOTTOM_RIGHT

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_BOTTOM_RIGHT = 108: Int
```

Represents the right third of the bottom side on a square device.  

### LOCATION_EAST

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_EAST = 0: Int
```

Represents the east position on a round device.  

### LOCATION_ENE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_ENE = 1: Int
```

Represents the east-northeast position on a round device.  

### LOCATION_ESE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_ESE = 15: Int
```

Represents the east-southeast position on a round device.  

### LOCATION_LEFT_BOTTOM

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_LEFT_BOTTOM = 105: Int
```

Represents the bottom third of the left side on a square device.  

### LOCATION_LEFT_CENTER

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_LEFT_CENTER = 104: Int
```

Represents the center third of the left side on a square device.  

### LOCATION_LEFT_TOP

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_LEFT_TOP = 103: Int
```

Represents the top third of the left side on a square device.  

### LOCATION_NE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_NE = 2: Int
```

Represents the northeast position on a round device.  

### LOCATION_NNE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_NNE = 3: Int
```

Represents the north-northeast position on a round device.  

### LOCATION_NNW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_NNW = 5: Int
```

Represents the north-northwest position on a round device.  

### LOCATION_NORTH

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_NORTH = 4: Int
```

Represents the north position on a round device.  

### LOCATION_NW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_NW = 6: Int
```

Represents the northwest position on a round device.  

### LOCATION_RIGHT_BOTTOM

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_RIGHT_BOTTOM = 109: Int
```

Represents the bottom third of the right side on a square device.  

### LOCATION_RIGHT_CENTER

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_RIGHT_CENTER = 110: Int
```

Represents the center third of the right side on a square device.  

### LOCATION_RIGHT_TOP

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_RIGHT_TOP = 111: Int
```

Represents the top third of the right side on a square device.  

### LOCATION_SE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_SE = 14: Int
```

Represents the southeast position on a round device.  

### LOCATION_SOUTH

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_SOUTH = 12: Int
```

Represents the south position on a round device.  

### LOCATION_SSE

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_SSE = 13: Int
```

Represents the south-southeast position on a round device.  

### LOCATION_SSW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_SSW = 11: Int
```

Represents the south-southwest position on a round device.  

### LOCATION_SW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_SW = 10: Int
```

Represents the southwest position on a round device.  

### LOCATION_TOP_CENTER

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_TOP_CENTER = 101: Int
```

Represents the center third of the top side on a square device.  

### LOCATION_TOP_LEFT

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_TOP_LEFT = 102: Int
```

Represents the left third of the top side on a square device.  

### LOCATION_TOP_RIGHT

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_TOP_RIGHT = 100: Int
```

Represents the right third of the top side on a square device.  

### LOCATION_UNKNOWN

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_UNKNOWN = -1: Int
```

Represents that the location zone is unknown.  

### LOCATION_WEST

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_WEST = 8: Int
```

Represents the west position on a round device.  

### LOCATION_WNW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_WNW = 7: Int
```

Represents the west-northwest position on a round device.  

### LOCATION_WSW

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
const val LOCATION_WSW = 9: Int
```

Represents the west-southwest position on a round device.  

## Public functions

### getButtonCount

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
java-static fun getButtonCount(context: Context): Int
```

Get the number of hardware buttons available. This count includes the primary stem key as well as any secondary stem keys available.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html) | The context of the current activity |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The number of buttons available, or the information is not available. |

### getButtonIcon

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
java-static fun getButtonIcon(context: Context, keycode: Int): Drawable?
```

Returns an icon that can be used to represent the location of a button.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html) | The context of the current activity                         |
| `keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The keycode associated with the hardware button of interest |

|                                            Returns                                             |
|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable.html)`?` | A drawable representing the location of a button, or null if unavailable |

### getButtonInfo

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
java-static fun getButtonInfo(context: Context, keycode: Int): WearableButtons.ButtonInfo?
```

Returns a[ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo)containing the metadata for a specific button.

The location will be populated in the following manner:

- The provided point will be on the screen, or more typically, on the edge of the screen.
- The point won't be off the edge of the screen.
- The location returned is a screen coordinate. The unit of measurement is in pixels. The coordinates do not take rotation into account and assume that the device is in the standard upright position.

Additionally, a location zone will be provided for the button, which will be one of the`LOCATION_*`constants. This defines the general area of the button on the device, and can be passed to[getButtonLabel](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#getButtonLabel(android.content.Context,int))to provide a human-understandable name for the location. There are two sets of locations for a device, depending on whether it is a circular or rectilinear device.

The "compass" locations (e.g.[LOCATION_ENE](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_ENE())) are used on a circular device. The locations for each are shown in the following image:![Image detailing the locations of compass locations on a Wear device. North is at the top, followed by north-north-east, north-east, east-north-east, east, and so on.](https://developer.android.com/images/reference/androidx/wear/wear-input/buttons_round.png)

The other locations (e.g.[LOCATION_BOTTOM_CENTER](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons#LOCATION_BOTTOM_CENTER())) are used on a rectilinear device. The locations for each are shown in the following image:![Image detailing the locations of other buttons on a Wear device. The first word details the side of the device the button is on, then the second word details where on that side the button is (e.g. 'TOP LEFT' means on the top edge, at the left hand side, and 'RIGHT BOTTOM' means on the right edge, at the bottom).](https://developer.android.com/images/reference/androidx/wear/wear-input/buttons_square.png)

Common keycodes to use are[KEYCODE_STEM_PRIMARY](https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_STEM_PRIMARY()),[KEYCODE_STEM_1](https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_STEM_1()),[KEYCODE_STEM_2](https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_STEM_2()), and[KEYCODE_STEM_3](https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_STEM_3()).  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html) | The context of the current activity                         |
| `keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The keycode associated with the hardware button of interest |

|                                                            Returns                                                             |
|--------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [WearableButtons.ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo)`?` | A[ButtonInfo](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtons.ButtonInfo)containing the metadata for the given keycode or null if the information is not available |

### getButtonLabel

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
java-static fun getButtonLabel(context: Context, keycode: Int): CharSequence?
```

Returns a CharSequence that describes the placement location of a button. An example might be "Top right" or "Bottom".  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-------------------------------------------------------------|
| `context: `[Context](https://developer.android.com/reference/android/content/Context.html) | The context of the current activity                         |
| `keycode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)     | The keycode associated with the hardware button of interest |

|                                              Returns                                              |
|---------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| [CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`?` | A CharSequence describing the placement location of the button, or null if no location is available for that button. |

### setWearableButtonsProvider

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear#1.2.0)  

```
@VisibleForTesting
java-static fun setWearableButtonsProvider(provider: WearableButtonsProvider): Unit
```

Testing call to allow the underlying[WearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtonsProvider)to be substituted in test code.  

|                                                            Parameters                                                             |
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| `provider: `[WearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtonsProvider) | The new[WearableButtonsProvider](https://developer.android.com/reference/kotlin/androidx/wear/input/WearableButtonsProvider)to use. |