This is my code for creating a dialog box.
public void onClick(View v) { try{ Builder dialog= new AlertDialog.Builder(context); dialog.setTitle(R.string.dialog_title1); dialog.setMessage(R.string.url); dialog.setPositiveButton(R.string.dialog_ok, null); dialog.show(); }
I want to add an event listener to the SetPositive Button (OK button). When you click OK, my application should be closed, and the user should exit the application. Can someone help me achieve this?
source share