I created an alertdialog with two switches in it. When the user selects a parameter, I need to reject alertdialog, but I could not reject it.
final CharSequence[] items = {"First Option", "Second Option"}; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Choose an option"); builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show(); } }); final AlertDialog alert = builder.create(); alert.show();
Can someone help me how to do this.
thanks
source share