Simulate a key press on Android
来源:互联网 发布:数据迁移的重要性 编辑:程序博客网 时间:2024/06/02 03:28
Method 1:
import android.app.Instrumentation;new Thread(new Runnable() { @Override public void run() { try { Instrumentation inst = new Instrumentation(); for ( int i = 0; i < 10; ++i ) { inst.sendKeyDownUpSync(KeyEvent.KEYCODE_2); Thread.sleep(2000); inst.sendKeyDownUpSync(KeyEvent.KEYCODE_3); Thread.sleep(2000); } } catch(InterruptedException e){ } }}).start();
Method 2:
import android.view.inputmethod.BaseInputConnection;import android.view.KeyEvent;BaseInputConnection inputConnection = new BaseInputConnection(edittext1, true);inputConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_1));
阅读全文
1 0
- Simulate a key press on Android
- Python Get Key press
- How to add a new key on android
- [WP7] How to press the mouse on a control, and detect MouseLeftButtonUp on another
- Insert boot media in selected boot device and press a key
- simulate grep- leave key word lines
- A Note on CMake - 3 Key words
- Key down, key up, key press 的区别
- reboot and select proper boot device or insert boot media in selected boot device and press a key
- Reboot and select proper Boot device or Insert Boot Media in Selected Boot device and press a key的解决
- reboot and select proper boot device r Insert boot Media in selected boot device and press a key解决方法
- U盘安装Ubuntu15.04 出现boot failed: please change disks and press a key to continue 错误
- android press 事件监测
- Catching the "Home" key press in Smartphone.
- Load Error!Press any key to reboot
- press any key to out demo
- js---press the Enter key to submit
- Simulate a Form POST Request Using WinInet
- POJ 1061
- react native常用组件
- [LeetCode] 191. Number of 1 Bits
- Node.js学习:基本目录结构
- [高频] 六.数学,几何计算,位运算常见问题
- Simulate a key press on Android
- 欢迎使用CSDN-markdown编辑器
- Spark Release 2.2.0 最新版本发布,Spark 2.2.0是Spark 2.x中第一个在生产环境可以使用的版本,对于Spark具有里程碑意义
- Python----检测字符串是否是十进制格式的IP地址
- mybatis 查询数量有结果,但查询列表时返回空
- Oracle数据库补充
- 加快建设开放型经济新体制,自觉运用法律武器依法维权
- 数据库操作
- 按词典顺序输出数字