IT. Expert System.

Android Reference

InputDevice


android.view

Class InputDevice

  • All Implemented Interfaces:
    Parcelable


    public final class InputDevice
    extends Object
    implements Parcelable
    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.

    • Method Detail

      • getDevice

        public static InputDevice getDevice(int id)
        Gets information about the input device with the specified id.
        Parameters:
        id - The device id.
        Returns:
        The input device or null if not found.
      • getDeviceIds

        public static int[] getDeviceIds()
        Gets the ids of all input devices in the system.
        Returns:
        The input device ids.
      • getId

        public int getId()
        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().

        Returns:
        The input device id.
      • getGeneration

        public int getGeneration()
        Gets a generation number for this input device. The generation number is incremented whenever the device is reconfigured and its properties may have changed.
        Returns:
        The generation number.
      • getDescriptor

        public String getDescriptor()
        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.

        It is possible for there to be multiple InputDevice instances that have the same input device descriptor. This might happen in situations where a single human input device registers multiple InputDevice instances (HID collections) that describe separate features of the device, such as a keyboard that also has a trackpad. Alternately, it may be that the input devices are simply indistinguishable, such as two keyboards made by the same manufacturer.

        The input device descriptor returned by getDescriptor() should only be used when an application needs to remember settings associated with a particular input device. For all other purposes when referring to a logical InputDevice instance at runtime use the id returned by getId().

        Returns:
        The input device descriptor.
      • isVirtual

        public boolean 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).

        Virtual input devices are provided to implement system-level functionality and should not be seen or configured by users.

        Returns:
        True if the device is virtual.
        See Also:
        KeyCharacterMap.VIRTUAL_KEYBOARD
      • isExternal

        public boolean isExternal()
        Returns true if the device is external (connected to USB or Bluetooth or some other peripheral bus), otherwise it is built-in.
        Returns:
        True if the device is external.
      • isFullKeyboard

        public boolean isFullKeyboard()
        Returns true if the device is a full keyboard.
        Returns:
        True if the device is a full keyboard.
      • getName

        public String getName()
        Gets the name of this input device.
        Returns:
        The input device name.
      • getSources

        public int getSources()
        Gets the input sources supported by this input device as a combined bitfield.
        Returns:
        The supported input sources.
      • getKeyboardType

        public int getKeyboardType()
        Gets the keyboard type.
        Returns:
        The keyboard type.
      • getKeyCharacterMap

        public KeyCharacterMap getKeyCharacterMap()
        Gets the key character map associated with this input device.
        Returns:
        The key character map.
      • getMotionRange

        public InputDevice.MotionRange getMotionRange(int axis)
        Gets information about the range of values for a particular MotionEvent axis. If the device supports multiple sources, the same axis may have different meanings for each source. Returns information about the first axis found for any source. To obtain information about the axis for a specific source, use getMotionRange(int, int).
        Parameters:
        axis - The axis constant.
        Returns:
        The range of values, or null if the requested axis is not supported by the device.
        See Also:
        MotionEvent.AXIS_X, MotionEvent.AXIS_Y, #getSupportedAxes()
      • getMotionRange

        public InputDevice.MotionRange getMotionRange(int axis,
                                             int source)
        Gets information about the range of values for a particular MotionEvent axis used by a particular source on the device. If the device supports multiple sources, the same axis may have different meanings for each source.
        Parameters:
        axis - The axis constant.
        source - The source for which to return information.
        Returns:
        The range of values, or null if the requested axis is not supported by the device.
        See Also:
        MotionEvent.AXIS_X, MotionEvent.AXIS_Y, #getSupportedAxes()
      • getVibrator

        public Vibrator getVibrator()
        Gets the vibrator service associated with the device, if there is one. Even if the device does not have a vibrator, the result is never null. Use Vibrator.hasVibrator() to determine whether a vibrator is present. Note that the vibrator associated with the device may be different from the system vibrator. To obtain an instance of the system vibrator instead, call Context.getSystemService(java.lang.String) with Context.VIBRATOR_SERVICE as argument.
        Returns:
        The vibrator service associated with the device, never null.
      • describeContents

        public int describeContents()
        Description copied from interface: Parcelable
        Describe the kinds of special objects contained in this Parcelable's marshalled representation.
        Specified by:
        describeContents in interface Parcelable
        Returns:
        a bitmask indicating the set of special object types marshalled by the Parcelable.
      • toString

        public String toString()
        Description copied from class: Object
        Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
           getClass().getName() + '@' + Integer.toHexString(hashCode())

        See Writing a useful toString method if you intend implementing your own toString method.

        Overrides:
        toString in class Object
        Returns:
        a printable representation of this object.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 237 / 158810236. Delta: 0.03461 с