I have implement an application with many screens, an used android:noHistory="true" for exiting from any of the screen… I have EXIT Button on all the Screens in my application..
But i have faced a problem while processing the Application, In table if the user clicks on the BACK Button the application ends…

Now i’m looking for an AlertDialog while the User clicks on the Default Back Button..
Suggest me any solution for the problem.
After Some Suggestion i tried this, and this also Not Worked..
The Code which i tried is..
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
AlertDialog.Builder builder = new AlertDialog.Builder(Login.this);
builder.setMessage("Are you Sure want to close the Application..?")
.setCancelable(false)
.setTitle("EXIT")
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
Override onBackPressed of the activity to do whatever you want (like pop up a dialog).