public void testClick(View v){
/**
* 方法1
*/
new Thread(){
public void run() {
Instrumentation in=new Instrumentation();
in.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
};
}.start();
/**
* 方法2
*/
new Thread(){
public void run() {
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("input keyevent " + KeyEvent.KEYCODE_BACK);
} catch (IOException e) {
e.printStackTrace();
}
};
}.start();

}

更多相关文章

  1. android中view组件使用详解
  2. android 隐藏状态栏和导航栏
  3. android如何调用Web Service手机归属地练习
  4. android获取控件的几种方法
  5. Android代码混淆官方实现方法
  6. Android(安卓)获取手机屏幕大小两种方法
  7. android开关按钮,Switch,ToggleButton,RadioButton,CheckBox ,多种实
  8. 浅谈Java中Collections.sort对List排序的两种方法
  9. Python list sort方法的具体使用

随机推荐

  1. 让Android 设备通过USB 转RJ45有线网卡上
  2. Android中ListView的性能问题
  3. Android Launcher 设置壁纸
  4. 成为Android高手必须掌握的28大项内容和1
  5. Android APK 签名比对,防止软件被破解使用
  6. Android开发笔记(四十)组件通讯工具Intent
  7. Android BitmapShader 实战 实现圆形、圆
  8. 默认墨迹天气 下雪效果
  9. Android Picasso Dropbox:如何将图像加载
  10. android MediaScanner 扫出来的ID3 MP3文