[Solved] If edit text contains spaces then show error [closed]


There should be no ” ” space in the EditText is what you want.
Nobody will provide you with a ready working code. Here are some pointers to proceed.

String a = text.getText().toString();");

This will help you get the string in the edittext

So you have the string that the user had entered in the edittexxt.
No you need to use a simple function that will check if a character is present in the string.

String s= String from edittext;
boolean p=s.contains(" ");
if(p)
    //call function for error
else
    //safe to proceed

solved If edit text contains spaces then show error [closed]