728x90

뒤로가기 클릭 시 종료여부 묻기

@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
if(keyCode == KeyEvent.KEYCODE_BACK){
new AlertDialog.Builder(KdRefereeActivity.this)
.setTitle("TITLE")
.setMessage("MESSAGE")
.setPositiveButton("YES", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
moveTaskToBack(true);
finish();
}
})
.setNegativeButton("NO", null)
.show();
}
return super.onKeyDown(keyCode, event);
}

728x90

+ Recent posts