Tuesday, 25 February 2014

Empty Edit Text Gives Error Message

Here is a the code to check if EditText is not empty in android and if it's empty it will make a toast message on screen. After showing message it will return to last activity.
** here etHeight is the EditText component.





if(etHeight.getText().toString().trim().equals("")|| etWeight.getText().toString().trim().equals("")){
            Toast.makeText(this, "plz don't leave any blank textbox ", Toast.LENGTH_SHORT).show();
            return;
        }
        else{
            //WRITE YOUR CODE HERE        }

       

PLZ GIVE CONSTRUCTIVE COMMENTS.

No comments:

Post a comment