I\'m having trouble closing my alert dialog. I am using a layout inflator to make the dialog, so I\'m not sure how I would go about closing the thing after I\'m done with it
You get error, Try this code
dialog.setView(layout); final AlertDialog alertDialog = dialog.create(); add_item.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if (alertDialog != null && alertDialog.isShowing()) { alertDialog.dismiss(); } } }); alertDialog.show();