Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level
29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [XML Attrs](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#lattrs) \| [Fields](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#lfields) \| [Ctors](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#pubctors) \| [Methods](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#inhmethods)

# Keyboard.Key

*** ** * ** ***


`
public
static


class
Keyboard.Key
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.inputmethodservice.Keyboard.Key |

<br />

*** ** * ** ***

Class for describing the position and characteristics of a single key in the keyboard.

## Summary

| ### XML attributes ||
|---|---|
| [`android:codes`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:codes) | *This is deprecated. Copy this definition into your own application project. May be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character;* *May be an integer value, such as "`100`".* |
| [`android:horizontalGap`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:horizontalGap) | *This is deprecated. Copy this definition into your own application project. May be a dimension value, which is a floating point number appended with a unit such as "`14.5sp`". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).* *May be a fractional value, which is a floating point number appended with either % or %p, such as "`14.5%`". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.* |
| [`android:iconPreview`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:iconPreview) | *This is deprecated. Copy this definition into your own application project.* *May be a reference to another resource, in the form "`@[+][*package*:]*type*/*name*`" or a theme attribute in the form "`?[*package*:]*type*/*name*`".* |
| [`android:isModifier`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:isModifier) | *This is deprecated. Copy this definition into your own application project.* *May be a boolean value, such as "`true`" or "`false`".* |
| [`android:isRepeatable`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:isRepeatable) | *This is deprecated. Copy this definition into your own application project.* *May be a boolean value, such as "`true`" or "`false`".* |
| [`android:isSticky`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:isSticky) | *This is deprecated. Copy this definition into your own application project.* *May be a boolean value, such as "`true`" or "`false`".* |
| [`android:keyEdgeFlags`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyEdgeFlags) | *This is deprecated. Copy this definition into your own application project. Must be one or more (separated by '\|') of the following constant values. | Constant | Value | Description | |---|---|---| | left | 1 | Key is anchored to the left of the keyboard.Copy this definition into your own application project. | | right | 2 | Key is anchored to the right of the keyboard.Copy this definition into your own application project. |* |
| [`android:keyHeight`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyHeight) | *This is deprecated. Copy this definition into your own application project. May be a dimension value, which is a floating point number appended with a unit such as "`14.5sp`". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).* *May be a fractional value, which is a floating point number appended with either % or %p, such as "`14.5%`". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.* |
| [`android:keyIcon`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyIcon) | *This is deprecated. Copy this definition into your own application project.* *May be a reference to another resource, in the form "`@[+][*package*:]*type*/*name*`" or a theme attribute in the form "`?[*package*:]*type*/*name*`".* |
| [`android:keyLabel`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyLabel) | *This is deprecated. Copy this definition into your own application project.* *May be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character;* |
| [`android:keyOutputText`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyOutputText) | *This is deprecated. Copy this definition into your own application project.* *May be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character;* |
| [`android:keyWidth`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:keyWidth) | *This is deprecated. Copy this definition into your own application project. May be a dimension value, which is a floating point number appended with a unit such as "`14.5sp`". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), and mm (millimeters).* *May be a fractional value, which is a floating point number appended with either % or %p, such as "`14.5%`". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container.* |
| [`android:popupCharacters`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:popupCharacters) | *This is deprecated. Copy this definition into your own application project.* *May be a string value, using '\\\\;' to escape characters such as '\\\\n' or '\\\\uxxxx' for a unicode character;* |
| [`android:popupKeyboard`](https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#attr_android:popupKeyboard) | *This is deprecated. Copy this definition into your own application project.* *May be a reference to another resource, in the form "`@[+][*package*:]*type*/*name*`" or a theme attribute in the form "`?[*package*:]*type*/*name*`".* |

| ### Fields ||
|---|---|
| ` public int[]` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#codes` All the key codes (unicode or custom code) that this key could generate, zero'th being the most important. |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#edgeFlags` Flags that specify the anchoring to edges of the keyboard for detecting touch events that are just out of the boundary of the key. |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#gap` The horizontal gap before this key |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#height` Height of the key, not including the gap |
| ` public https://developer.android.com/reference/android/graphics/drawable/Drawable` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#icon` Icon to display instead of a label. |
| ` public https://developer.android.com/reference/android/graphics/drawable/Drawable` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#iconPreview` Preview version of the icon, for the preview popup |
| ` public https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#label` Label to display |
| ` public boolean` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#modifier` Whether this is a modifier key, such as Shift or Alt |
| ` public boolean` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#on` If this is a sticky key, is it on? |
| ` public https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#popupCharacters` Popup characters |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#popupResId` If this key pops up a mini keyboard, this is the resource id for the XML layout for that keyboard. |
| ` public boolean` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#pressed` The current pressed state of this key |
| ` public boolean` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#repeatable` Whether this key repeats itself when held down |
| ` public boolean` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#sticky` Whether this key is sticky, i.e., a toggle key |
| ` public https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#text` Text to output when pressed. |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#width` Width of the key, not including the gap |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#x` X coordinate of the key in the keyboard layout |
| ` public int` | `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#y` Y coordinate of the key in the keyboard layout |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#Key(android.content.res.Resources,%20android.inputmethodservice.Keyboard.Row,%20int,%20int,%20android.content.res.XmlResourceParser)(https://developer.android.com/reference/android/content/res/Resources res, https://developer.android.com/reference/android/inputmethodservice/Keyboard.Row parent, int x, int y, https://developer.android.com/reference/android/content/res/XmlResourceParser parser) ` Create a key with the given top-left coordinate and extract its attributes from the XML parser. |
| ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#Key(android.inputmethodservice.Keyboard.Row)(https://developer.android.com/reference/android/inputmethodservice/Keyboard.Row parent) ` Create an empty key with no attributes. |

| ### Public methods ||
|---|---|
| ` int[]` | ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#getCurrentDrawableState()() ` Returns the drawable state for the key, based on the current state and type of the key. |
| ` boolean` | ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#isInside(int,%20int)(int x, int y) ` Detects if a point falls inside this key. |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#onPressed()() ` Informs the key that it has been pressed, in case it needs to change its appearance or state. |
| ` void` | ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#onReleased(boolean)(boolean inside) ` Changes the pressed state of the key. |
| ` int` | ` https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#squaredDistanceFrom(int,%20int)(int x, int y) ` Returns the square of the distance between the center of the key and the given point. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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*. | ||

## XML attributes

### android:codes


**This is deprecated.**   

Copy this definition into your own application project.

May be a string value, using '\\\\;' to escape characters such as
'\\\\n' or '\\\\uxxxx' for a unicode character;

May be an integer value, such as "`100`".

The unicode value or comma-separated values that this key outputs.

<br />

### android:horizontalGap


**This is deprecated.**   

Copy this definition into your own application project.

May be a dimension value, which is a floating point number appended with a
unit such as "`14.5sp`".
Available units are: px (pixels), dp (density-independent pixels),
sp (scaled pixels based on preferred font size), in (inches), and
mm (millimeters).

May be a fractional value, which is a floating point number appended with
either % or %p, such as "`14.5%`".
The % suffix always means a percentage of the base size;
the optional %p suffix provides a size relative to some parent container.

Default horizontal gap between keys.

<br />

### android:iconPreview


**This is deprecated.**   

Copy this definition into your own application project.

May be a reference to another resource, in the form
"`@[+][*package*:]*type*/*name*`" or a theme
attribute in the form
"`?[*package*:]*type*/*name*`".

The icon to show in the popup preview.

<br />

### android:isModifier


**This is deprecated.**   

Copy this definition into your own application project.

May be a boolean value, such as "`true`" or
"`false`".

Whether this is a modifier key such as Alt or Shift.

<br />

### android:isRepeatable


**This is deprecated.**   

Copy this definition into your own application project.

May be a boolean value, such as "`true`" or
"`false`".

Whether long-pressing on this key will make it repeat.

<br />

### android:isSticky


**This is deprecated.**   

Copy this definition into your own application project.

May be a boolean value, such as "`true`" or
"`false`".

Whether this is a toggle key.

<br />

### android:keyEdgeFlags


**This is deprecated.**   

Copy this definition into your own application project.

Must be one or more (separated by '\|') of the following constant values.

| Constant | Value | Description |
|---|---|---|
| left | 1 | Key is anchored to the left of the keyboard.Copy this definition into your own application project. |
| right | 2 | Key is anchored to the right of the keyboard.Copy this definition into your own application project. |

<br />

Key edge flags.

<br />

### android:keyHeight


**This is deprecated.**   

Copy this definition into your own application project.

May be a dimension value, which is a floating point number appended with a
unit such as "`14.5sp`".
Available units are: px (pixels), dp (density-independent pixels),
sp (scaled pixels based on preferred font size), in (inches), and
mm (millimeters).

May be a fractional value, which is a floating point number appended with
either % or %p, such as "`14.5%`".
The % suffix always means a percentage of the base size;
the optional %p suffix provides a size relative to some parent container.

Default height of a key, in pixels or percentage of display width.

<br />

### android:keyIcon


**This is deprecated.**   

Copy this definition into your own application project.

May be a reference to another resource, in the form
"`@[+][*package*:]*type*/*name*`" or a theme
attribute in the form
"`?[*package*:]*type*/*name*`".

The icon to display on the key instead of the label.

<br />

### android:keyLabel


**This is deprecated.**   

Copy this definition into your own application project.

May be a string value, using '\\\\;' to escape characters such as
'\\\\n' or '\\\\uxxxx' for a unicode character;

The label to display on the key.

<br />

### android:keyOutputText


**This is deprecated.**   

Copy this definition into your own application project.

May be a string value, using '\\\\;' to escape characters such as
'\\\\n' or '\\\\uxxxx' for a unicode character;

The string of characters to output when this key is pressed.

<br />

### android:keyWidth


**This is deprecated.**   

Copy this definition into your own application project.

May be a dimension value, which is a floating point number appended with a
unit such as "`14.5sp`".
Available units are: px (pixels), dp (density-independent pixels),
sp (scaled pixels based on preferred font size), in (inches), and
mm (millimeters).

May be a fractional value, which is a floating point number appended with
either % or %p, such as "`14.5%`".
The % suffix always means a percentage of the base size;
the optional %p suffix provides a size relative to some parent container.

Default width of a key, in pixels or percentage of display width.

<br />

### android:popupCharacters


**This is deprecated.**   

Copy this definition into your own application project.

May be a string value, using '\\\\;' to escape characters such as
'\\\\n' or '\\\\uxxxx' for a unicode character;

The characters to display in the popup keyboard.

<br />

### android:popupKeyboard


**This is deprecated.**   

Copy this definition into your own application project.

May be a reference to another resource, in the form
"`@[+][*package*:]*type*/*name*`" or a theme
attribute in the form
"`?[*package*:]*type*/*name*`".

The XML keyboard layout of any popup keyboard.

<br />

## Fields

### codes

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

```
public int[] codes
```

All the key codes (unicode or custom code) that this key could generate, zero'th
being the most important.

<br />

### edgeFlags

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

```
public int edgeFlags
```

Flags that specify the anchoring to edges of the keyboard for detecting touch events
that are just out of the boundary of the key. This is a bit mask of
`https://developer.android.com/reference/android/inputmethodservice/Keyboard#EDGE_LEFT`, `https://developer.android.com/reference/android/inputmethodservice/Keyboard#EDGE_RIGHT`, `https://developer.android.com/reference/android/inputmethodservice/Keyboard#EDGE_TOP` and
`https://developer.android.com/reference/android/inputmethodservice/Keyboard#EDGE_BOTTOM`.

<br />

### gap

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

```
public int gap
```

The horizontal gap before this key

<br />

### height

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

```
public int height
```

Height of the key, not including the gap

<br />

### icon

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

```
public Drawable icon
```

Icon to display instead of a label. Icon takes precedence over a label

<br />

### iconPreview

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

```
public Drawable iconPreview
```

Preview version of the icon, for the preview popup

<br />

### label

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

```
public CharSequence label
```

Label to display

<br />

### modifier

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

```
public boolean modifier
```

Whether this is a modifier key, such as Shift or Alt

<br />

### on

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

```
public boolean on
```

If this is a sticky key, is it on?

<br />

### popupCharacters

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

```
public CharSequence popupCharacters
```

Popup characters

<br />

### popupResId

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

```
public int popupResId
```

If this key pops up a mini keyboard, this is the resource id for the XML layout for that
keyboard.

<br />

### pressed

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

```
public boolean pressed
```

The current pressed state of this key

<br />

### repeatable

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

```
public boolean repeatable
```

Whether this key repeats itself when held down

<br />

### sticky

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

```
public boolean sticky
```

Whether this key is sticky, i.e., a toggle key

<br />

### text

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

```
public CharSequence text
```

Text to output when pressed. This can be multiple characters, like ".com"

<br />

### width

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

```
public int width
```

Width of the key, not including the gap

<br />

### x

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

```
public int x
```

X coordinate of the key in the keyboard layout

<br />

### y

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

```
public int y
```

Y coordinate of the key in the keyboard layout

<br />

## Public constructors

### Key

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

```
public Key (Resources res, 
                Keyboard.Row parent, 
                int x, 
                int y, 
                XmlResourceParser parser)
```

Create a key with the given top-left coordinate and extract its attributes from
the XML parser.

<br />

| Parameters ||
|---|---|
| `res` | `Resources`: resources associated with the caller's context <br /> |
| `parent` | `Keyboard.Row`: the row that this key belongs to. The row must already be attached to a `https://developer.android.com/reference/android/inputmethodservice/Keyboard`. <br /> |
| `x` | `int`: the x coordinate of the top-left <br /> |
| `y` | `int`: the y coordinate of the top-left <br /> |
| `parser` | `XmlResourceParser`: the XML parser containing the attributes for this key <br /> |

### Key

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

```
public Key (Keyboard.Row parent)
```

Create an empty key with no attributes.

<br />

| Parameters ||
|---|---|
| `parent` | `Keyboard.Row` <br /> |

## Public methods

### getCurrentDrawableState

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

```
public int[] getCurrentDrawableState ()
```

Returns the drawable state for the key, based on the current state and type of the key.

<br />

| Returns ||
|---|---|
| `int[]` | the drawable state of the key. <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/drawable/Drawable#setState(int[])`

### isInside

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

```
public boolean isInside (int x, 
                int y)
```

Detects if a point falls inside this key.

<br />

| Parameters ||
|---|---|
| `x` | `int`: the x-coordinate of the point <br /> |
| `y` | `int`: the y-coordinate of the point <br /> |

| Returns ||
|---|---|
| `boolean` | whether or not the point falls inside the key. If the key is attached to an edge, it will assume that all points between the key and the edge are considered to be inside the key. <br /> |

### onPressed

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

```
public void onPressed ()
```

Informs the key that it has been pressed, in case it needs to change its appearance or
state.

<br />

**See also:**

- `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#onReleased(boolean)`

### onReleased

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

```
public void onReleased (boolean inside)
```

Changes the pressed state of the key.

Toggled state of the key will be flipped when all the following conditions are
fulfilled:

- This is a sticky key, that is, `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#sticky` is `true`.
- The parameter `inside` is `true`.
- `https://developer.android.com/reference/android/os/Build.VERSION#SDK_INT` is greater than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#LOLLIPOP_MR1`.

<br />

<br />

| Parameters ||
|---|---|
| `inside` | `boolean`: whether the finger was released inside the key. Works only on Android M and later. See the method document for details. <br /> |

**See also:**

- `https://developer.android.com/reference/android/inputmethodservice/Keyboard.Key#onPressed()`

### squaredDistanceFrom

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

```
public int squaredDistanceFrom (int x, 
                int y)
```

Returns the square of the distance between the center of the key and the given point.

<br />

| Parameters ||
|---|---|
| `x` | `int`: the x-coordinate of the point <br /> |
| `y` | `int`: the y-coordinate of the point <br /> |

| Returns ||
|---|---|
| `int` | the square of the distance of the point from the center of the key <br /> |