Actually my issue is when i press the back button it shows a dialog
and also at the same time the application finished without any operation on key? Can any one solve this?
@Override
public void onBackPressed() {
super.onBackPressed();
AlertDialog.Builder ab = new AlertDialog.Builder(this);
ab.setMessage("Really want to exit");
ab.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
ab.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Main.super.onBackPressed();
}
});
ab.create();
ab.show();
}