I want to close total application in android when i click on "NO" Button in Dialog. i have used the following code.
protected Dialog onCreateDialog(int id) {
switch (id) {
case 0:
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
builder1.setTitle("GASIMIZER");
builder1.setCancelable(false)
.setPositiveButton("YES",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent i = new Intent(Finalpage.this,NewproActivity.class);
startActivity(i);
}
})
.setNegativeButton("NO",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which)
{
quit();
}
});
AlertDialog alert1 = builder1.create();
alert1.show();
break;
}
return null;
}
public void quit() {
onDestroy();
}
please any one tell me how can i solve this problem.