I create inflating Layout and I make button that i want to close dialog when click the button.
final AlertDialog.Builder alert = new AlertDialog.Builder(this);
LayoutInflater factory = LayoutInflater.from(this);
final View textEntryView = factory.inflate(R.layout.subtractalert,null);
the button code
final Button delete = (Button) textEntryView.findViewById(R.id.deleteButton);
delete.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// I want to close the dialog at here
}
});
Thanks for all answer, tell me if you want more code 🙂
You must first call
.show()on thealertvariable. You can then use.dismiss()to get rid of the dialog, as long as your statements are within the same method.