private longToatlong;
@Override
public voidonBackPressed() {
// super.onBackPressed();
if(Toatlong<=0){
Toast.makeText(MainActivity.this,"再按一次退出",Toast.LENGTH_SHORT).show();
Toatlong= System.currentTimeMillis();
}else{
longcurrentTime = System.currentTimeMillis();
if(currentTime-Toatlong<=1000){
finish();
}else{
Toatlong= currentTime;
Toast.makeText(MainActivity.this,"再按一次退出",Toast.LENGTH_SHORT).show();
}
}
}