/** * 模拟硬键盘发送 */private void sendToApp() {String currentPkgName = mImeService.getImeService().getCurrentInputEditorInfo().packageName;if (mContext.getString(R.string.setting_tencent_mm_package).equals(currentPkgName)) {InputConnection inputconnection = mImeService.getInputConnection();CharSequence cb = inputconnection.getTextAfterCursor(1000, 0);            CharSequence ca = inputconnection.getTextBeforeCursor(1000, 0);            int len = cb.length() + ca.length();inputconnection.setSelection(len, len);mImeService.sendKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);mImeService.sendKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);try {TimeUnit.MILLISECONDS.sleep(50);} catch (InterruptedException e) {// just ignore}mImeService.sendKeyEvent(KeyEvent.KEYCODE_DPAD_CENTER);//try {//TimeUnit.MILLISECONDS.sleep(50);//} catch (InterruptedException e) {//// just ignore//}//mImeService.sendKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);//mImeService.sendKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);} else {mImeService.setHcrFullCheckMode();showEditPopWindow();}}

更多相关文章

  1. android监听键盘弹出or隐藏方法
  2. Android监听Home键和最近任务
  3. android显示隐藏软键盘
  4. android发送json并解析返回json
  5. android隐藏以及显示软键盘
  6. android软键盘问题
  7. Android之常用功能代码
  8. android带输入框的Dialog
  9. android发送json并解析返回json

随机推荐

  1. Caused by: com.android.builder.dexing.
  2. Android通过点击按钮改变Activity的背景
  3. android PathData生成问题
  4. Android Studio报错:Could not GET 'https
  5. Android Studio(十):添加assets目录
  6. Android 复习资料
  7. Android(安卓)GPS 定位的实现
  8. Android界面编程之实现改变图片透明度并
  9. 【android】Intent 和 Intent Filter
  10. Android 异步加载深入解析