Example usage for android.view KeyEvent KeyEvent

List of usage examples for android.view KeyEvent KeyEvent

Introduction

In this page you can find the example usage for android.view KeyEvent KeyEvent.

Prototype

public KeyEvent(long time, String characters, int deviceId, int flags) 

Source Link

Document

Create a new key event for a string of characters.

Usage

From source file:io.trigger.forge.android.modules.keyboard.API.java

private static Runnable typeString(final EditText webTextView, final String text) {
    return new Runnable() {
        @Override//www.jav a 2 s . c  o  m
        public void run() {
            webTextView.dispatchKeyEvent(
                    new KeyEvent(SystemClock.uptimeMillis(), text, KeyCharacterMap.VIRTUAL_KEYBOARD, 0));
        }
    };
}

From source file:com.iiordanov.bVNC.RemoteCanvas.java

/**
 * Sends over the unix username and password if this is VNC over SSH connectio and automatic sending of 
 * UNIX credentials is enabled for AutoX (for x11vnc's "-unixpw" option).
 *///from   w ww.j  ava 2s  .c  o  m
void sendUnixAuth() {
    // If the type of connection is ssh-tunneled and we are told to send the unix credentials, then do so.
    if (connection.getConnectionType() == Constants.CONN_TYPE_SSH && connection.getAutoXUnixAuth()) {
        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_UNKNOWN,
                new KeyEvent(SystemClock.uptimeMillis(), connection.getSshUser(), 0, 0));
        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_ENTER,
                new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_ENTER,
                new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));

        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_UNKNOWN,
                new KeyEvent(SystemClock.uptimeMillis(), connection.getSshPassword(), 0, 0));
        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_ENTER,
                new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
        keyboard.processLocalKeyEvent(KeyEvent.KEYCODE_ENTER,
                new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_ENTER));
    }
}

From source file:info.staticfree.android.units.Units.java

private void sendTextAsSoftKeyboard(String text) {
    dispatchKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), text, Units.class.hashCode(),
            KeyEvent.FLAG_SOFT_KEYBOARD));
}

From source file:info.staticfree.android.units.Units.java

private void sendTextAsSoftKeyboard(String text, boolean moveToDefault) {
    dispatchKeyEvent(new KeyEvent(SystemClock.uptimeMillis(), text, Units.class.hashCode(),
            KeyEvent.FLAG_SOFT_KEYBOARD));
    if (moveToDefault) {
        workspace.moveToDefaultScreen();
    }/* ww  w .  j a va2 s.  co m*/
}