Public Boolean onKeyDown (int keyCode, KeyEvent event) {
If (keyCode==KeyEvent. KEYCODE_BACK) {
If (Constant. Time==0) {
Constant. Time=System. CurrentTimeMillis ();
ToastUtil. Toast (" then return once the desktop ");
} else {
If (System. CurrentTimeMillis () - Constant. Time & lt; 2500) {
Intent home=new Intent (Intent. ACTION_MAIN);
Home. SetFlags (Intent. FLAG_ACTIVITY_CLEAR_TOP);
Home. AddCategory (Intent. CATEGORY_HOME);
StartActivity (home);
Constant. The time=0;
} else {
Constant. Time=System. CurrentTimeMillis ();
ToastUtil. Toast (" then return once the desktop ");
}
}
return true;
}
return super.onKeyDown(keyCode, event);
}
This is to set up double click to return to the desktop, but the first double-click the execution after installation is finish () points behind open app to perform again, there is the code above the great god to explain it,,,
CodePudding user response:
To see the code,,, can understand what,,Why don't you try to play the log to see the log