调用getCurrentInputConnection()需要继承InputMethodService类。
利用输入法
getCurrentInputConnection().commitText("文本", "文本".length());
//以下两句为模拟回车
getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN,66));
getCurrentInputConnection().sendKeyEvent(new KeyEvent(KeyEvent.ACTION_UP,66));