客户有个需求是通过某个按键 默认打开camera 的前置摄像头并且录像
默认打开前置摄像头这个简单,但是要录像就有点难了,而且要保证camera的UI问题,
最后决定还是模拟点击事件
public void run() {
try {
Log.d(LOG_TAG, "isCreate() isCreate="+isCreate);
if(isCreate){
this.sleep(500);
}
Process p = Runtime.getRuntime().exec("input touchscreen tap 96 290"); 96=x 290=y
int status = p.waitFor();
if (status == 0) {
Log.d(LOG_TAG, "input ok");
}else{
Log.d(LOG_TAG, "input file");
}
} catch (IOException e) {
Log.e(LOG_TAG, "input test Failed: IOException");
} catch (InterruptedException e) {
Log.e(LOG_TAG, "input test Failed: InterruptedException");
}
};
}.start();
、、、
网友评论