Share via


KeyCharacterMap.GetNumber(Keycode) Method

Definition

Gets the number or symbol associated with the key.

[Android.Runtime.Register("getNumber", "(I)C", "GetGetNumber_IHandler")]
public virtual char GetNumber (Android.Views.Keycode keyCode);
[<Android.Runtime.Register("getNumber", "(I)C", "GetGetNumber_IHandler")>]
abstract member GetNumber : Android.Views.Keycode -> char
override this.GetNumber : Android.Views.Keycode -> char

Parameters

keyCode
Keycode

The key code.

Returns

The associated numeric or symbolic character, or 0 if none.

Attributes

Remarks

Gets the number or symbol associated with the key.

The character value is returned, not the numeric value. If the key is not a number, but is a symbol, the symbol is retuned.

This method is intended to to support dial pads and other numeric or symbolic entry on keyboards where certain keys serve dual function as alphabetic and symbolic keys. This method returns the number or symbol associated with the key independent of whether the user has pressed the required modifier.

For example, on one particular keyboard the keys on the top QWERTY row generate numbers when ALT is pressed such that ALT-Q maps to '1'. So for that keyboard when #getNumber is called with KeyEvent#KEYCODE_Q it returns '1' so that the user can type numbers without pressing ALT when it makes sense.

Java documentation for android.view.KeyCharacterMap.getNumber(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to