public boolean dispatchKeyEvent(KeyEvent event) {
目前創(chuàng)新互聯(lián)已為1000+的企業(yè)提供了網(wǎng)站建設(shè)、域名、網(wǎng)絡(luò)空間、網(wǎng)站托管、服務(wù)器租用、企業(yè)網(wǎng)站設(shè)計(jì)、射陽(yáng)網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
// TODO Auto-generated method stub
if(event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_BACK){
showDialog();
return false;
}
return super.dispatchKeyEvent(event);
}
public void showDialog(){
final CheckBox check = new CheckBox(this);
check.setText("退出后仍然接收通知 ?");
new AlertDialog.Builder(this)
.setTitle(R.string.app_name)
.setView(check)
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
}).setPositiveButton("確定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
if(check.isSelected() == true){
startBackService();
}
System.exit(0);
finish();
}
})
.show();
}