In my application I am showing AlertDialog.Builder
AlertDialog.Builder alert = new AlertDialog.Builder(this);
and in this alert there is one EditText and PositiveButton.
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setMessage("Enter Text");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
if(input.getTest().getText().toString().equalsIgnoreCase("")){
Toast.makeText(Activity.this, "Please enter some text", Toast.LENGTH_LONG).show();
}
}
alert.show();
If nothing is entered then it shows Please enter some text on toast and the dialog is closed but I want that Alert dialog to be closes. How can I achieve this?