Class KeyEvent

java.lang.Object
io.appium.java_client.android.nativekey.KeyEvent

public class KeyEvent extends Object
  • Constructor Details

    • KeyEvent

      public KeyEvent()
    • KeyEvent

      public KeyEvent(AndroidKey key)
  • Method Details

    • withKey

      public KeyEvent withKey(AndroidKey key)
      Sets the key code. This code is mandatory.
      Parameters:
      key - Native Android key.
      Returns:
      self instance for chaining
    • withMetaModifier

      public KeyEvent withMetaModifier(KeyEventMetaModifier keyEventMetaModifier)
      Adds the meta modifier.
      Parameters:
      keyEventMetaModifier - Native Android modifier value. Multiple modifiers can be combined into a single key event.
      Returns:
      self instance for chaining
    • withFlag

      public KeyEvent withFlag(KeyEventFlag keyEventFlag)
      Adds the flag.
      Parameters:
      keyEventFlag - Native Android flag value. Several flags can be combined into a single key event.
      Returns:
      self instance for chaining
    • build

      public Map<String,Object> build()
      Builds a map, which is ready to be used by the downstream API.
      Returns:
      API parameters mapping
      Throws:
      IllegalStateException - if key code is not set