I would like to keep my dialog open when I press a button. At the moment it\'s closing.
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder
You can get the Dialog returned from method "show()" alertBuidler.
AlertDialog.Builder adb = new AlertDialog.Builder(YourActivity.this);
//...code to add methods setPositive an setNegative buttons
Call the "show()" method of "adb" and get Dialog
final AlertDialog dialog = adb.show();
So you can call any button of your dialog at any point of code in your activity:
dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();//or
dialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();//or
dialog.getButton(DialogInterface.BUTTON_NEUTRAL).performClick();