AlertDialog.Builder not stay on screen
In my application I am showing AlertDialog.Builder
AlertDialog.Builder alert = new AlertDialog.Builder(this);
and in this aleart 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();
}
}
if nothing is entered then it show Please enter some text on tost and the
dialog is closed but I want the AleartDialog will not close. How this
possible?
No comments:
Post a Comment