Merhaba,
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK)) {
AlertDialog.Builder alertbox = new AlertDialog.Builder(MainActivity.this);
//alertbox.setIcon(R.drawable.info_icon);
alertbox.setTitle("Uygulamadan çıkmak istiyor musunuz?");
alertbox.setPositiveButton("Evet", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
// finish used for destroyed activity
finish();
}
});
alertbox.setNegativeButton("Hayır", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
//....
}
});
alertbox.show();
}
return super.onKeyDown(keyCode, event);
}
İyi çalışmalar.