问题描述
我想创建一个方法,如果 state_i = 1
持续 time
秒,则调用方法 alert_box()
,其中时间是以秒为单位的先前用户选择的值。
我不确定是否应该使用 handler.postDelayed
或计时器或 while 循环来实现此方法或其他方法?
目的是在用户闭眼一定时间后显示警告框。
谢谢
眼球追踪方法
private void eye_tracking(Face face) {
float l = face.getIsLeftEyeOpenProbability();
float r = face.getIsRightEyeOpenProbability();
if (l > THRESHOLD || r > THRESHOLD) {
state_i = 0;
Log.i(TAG,"onUpdate: Open Eyes Detected");
} else {
state_i = 1;
Log.i(TAG,"onUpdate: Closed Eyes Detected");
//If state_i = 1 for *time* seconds,call method alert_box();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)