InputDevice Class

Definition

Describes the capabilities of a particular input device.

[Android.Runtime.Register("android/view/InputDevice", DoNotGenerateAcw=true)]
public sealed class InputDevice : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/view/InputDevice", DoNotGenerateAcw=true)>]
type InputDevice = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
InputDevice
Attributes
Implements

Remarks

Describes the capabilities of a particular input device.

Each input device may support multiple classes of input. For example, a multi-function keyboard may compose the capabilities of a standard keyboard together with a track pad mouse or other pointing device.

Some input devices present multiple distinguishable sources of input. Applications can query the framework about the characteristics of each distinct source.

As a further wrinkle, different kinds of input sources uses different coordinate systems to describe motion events. Refer to the comments on the input source constants for the appropriate interpretation.

Java documentation for android.view.InputDevice.

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.

Fields

Name Description
KeyboardTypeAlphabetic
Obsolete.

The keyboard supports a complement of alphabetic keys.

KeyboardTypeNonAlphabetic
Obsolete.

The keyboard is not fully alphabetic.

KeyboardTypeNone
Obsolete.

There is no keyboard.

MotionRangeOrientation
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_ORIENTATION.

MotionRangePressure
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_PRESSURE.

MotionRangeSize
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_SIZE.

MotionRangeToolMajor
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_TOOL_MAJOR.

MotionRangeToolMinor
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_TOOL_MINOR.

MotionRangeTouchMajor
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_TOUCH_MAJOR.

MotionRangeTouchMinor
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_TOUCH_MINOR.

MotionRangeX
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_X.

MotionRangeY
Obsolete.

Constant for retrieving the range of values for MotionEvent#AXIS_Y.

SourceAny
Obsolete.

A special input source constant that is used when filtering input devices to match devices that provide any type of input source.

SourceBluetoothStylus
Obsolete.

The input device is a Bluetooth stylus.

SourceClassButton
Obsolete.

The input source has buttons or keys.

SourceClassJoystick
Obsolete.

The input source is a joystick.

SourceClassMask
Obsolete.

A mask for input source classes.

SourceClassNone
Obsolete.

The input source has no class.

SourceClassPointer
Obsolete.

The input source is a pointing device associated with a display.

SourceClassPosition
Obsolete.

The input source is an absolute positioning device not associated with a display (unlike #SOURCE_CLASS_POINTER).

SourceClassTrackball
Obsolete.

The input source is a trackball navigation device.

SourceDpad
Obsolete.

The input source is a DPad.

SourceGamepad
Obsolete.

The input source is a game pad.

SourceHdmi
Obsolete.

The input source is a device connected through HDMI-based bus.

SourceJoystick
Obsolete.

The input source is a joystick.

SourceKeyboard
Obsolete.

The input source is a keyboard.

SourceMouse
Obsolete.

The input source is a mouse pointing device.

SourceMouseRelative
Obsolete.

The input source is a mouse device whose relative motions should be interpreted as navigation events.

SourceRotaryEncoder
Obsolete.

The input source is a rotating encoder device whose motions should be interpreted as akin to those of a scroll wheel.

SourceSensor
Obsolete.

The input source is a sensor associated with the input device.

SourceStylus
Obsolete.

The input source is a stylus pointing device.

SourceTouchNavigation
Obsolete.

The input source is a touch device whose motions should be interpreted as navigation events.

SourceTouchpad
Obsolete.

The input source is a touchpad (also known as a trackpad).

SourceTouchscreen
Obsolete.

The input source is a touch screen pointing device.

SourceTrackball
Obsolete.

The input source is a trackball.

SourceUnknown
Obsolete.

The input source is unknown.

Properties

Name Description
BatteryState

Gets the battery state object associated with the device, if there is one. Even if the device does not have a battery, the result is never null. Use BatteryState.isPresent to determine whether a battery is present.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ControllerNumber

The controller number for a given input device.

Creator

Gets the parcelable creator for InputDevice instances.

Descriptor

Gets the input device descriptor, which is a stable identifier for an input device. An input device descriptor uniquely identifies an input device. Its value is intended to be persistent across system restarts, and should not change even if the input device is disconnected, reconnected or reconfigured at any time.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasMicrophone

Reports whether the device has a built-in microphone.

Id

Gets the input device id. Each input device receives a unique id when it is first configured by the system. The input device id may change when the system is restarted or if the input device is disconnected, reconnected or reconfigured at any time. If you require a stable identifier for a device that persists across boots and reconfigurations, use getDescriptor() .

IsEnabled

Returns true if input device is enabled.

IsExternal

Returns true if the device is external (connected to USB or Bluetooth or some other peripheral bus), otherwise it is built-in.

IsVirtual

Returns true if the device is a virtual input device rather than a real one, such as the virtual keyboard (see KeyCharacterMap#VIRTUAL_KEYBOARD).

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniPeerMembers

Gets the JNI peer metadata used by the .NET for Android binding runtime.

KeyboardType

Gets the keyboard type supported by this input device.

KeyCharacterMap

Gets the key character map associated with this input device.

LightsManager

Gets the lights manager associated with the device, if there is one. Even if the device does not have lights, the result is never null. Use LightsManager.getLights to determine whether any lights is present.

MotionRanges

Gets the ranges for all axes supported by the device.

Name

Gets the name of this input device.

PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ProductId

Gets the product id for the given device, if available. A product id uniquely identifies which product within the address space of a given vendor, identified by the device's vendor id. A value of 0 will be assigned where a product id is not available.

SensorManager

Gets the sensor manager service associated with the input device. Even if the device does not have a sensor, the result is never null. Use SensorManager.getSensorList to get a full list of all supported sensors. Note that the sensors associated with the device may be different from the system sensors, as typically they are builtin sensors physically attached to input devices.

Sources

Gets the input sources supported by this input device as a combined bitfield.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
VendorId

Gets the vendor id for the given device, if available. A vendor id uniquely identifies the company who manufactured the device. A value of 0 will be assigned where a vendor id is not available.

Vibrator

Gets the default vibrator associated with this input device.

VibratorManager

Gets the vibrator manager associated with the device. Even if the device does not have a vibrator manager, the result is never null. Use VibratorManager.getVibratorIds to determine whether any vibrator is present.

Methods

Name Description
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetDevice(Int32)

Gets information about the input device with the specified id.

GetDeviceIds()

Gets the ids of all input devices in the system.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetKeyCodeForKeyLocation(Int32)

Gets the android.view.KeyEvent key code produced by the given location on a reference QWERTY keyboard layout.

GetMotionRange(Axis, InputSourceType)

Gets information about the range of values for a particular MotionEvent axis.

GetMotionRange(Axis)

Gets information about the range of values for a particular MotionEvent axis.

GetMotionRange(Int32)
Obsolete.

Gets the motion range for the specified axis across all input sources.

HasKeys(Int32[])

Gets whether the device is capable of producing the list of keycodes.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SupportsSource(InputSourceType)

Determines whether the input device supports the given source or sources.

ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Flatten this object in to a Parcel.

Explicit Interface Implementations

Name Description
IJavaPeerable.Disposed()

Notifies the interop runtime that this managed peer has been disposed.

(Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced()

Releases this Java peer unless it is retained by another managed reference.

(Inherited from Object)
IJavaPeerable.Finalized()

Notifies the interop runtime that this managed peer has been finalized.

(Inherited from Object)
IJavaPeerable.JniManagedPeerState

Gets the state that describes the relationship between this managed peer and its JNI reference.

(Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32)

Sets the interop identity hash code for this Java peer.

(Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

Sets the managed and JNI peer state for this Java peer.

(Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference)

Sets the JNI object reference used by this managed peer.

(Inherited from Object)

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to