There are two EditText and a submit button with the onClick() method.
When you click on a button in the method, the code for sending data from the fields to the server is triggered.
You need to check the number of characters for the minimum value (6 characters). And check that both EditText fields are not empty.
Here is my code:
user = (EditText) findViewById(R.id.user); password = (EditText) findViewById(R.id.password); l_user = user.getText().toString(); p_user = password.getText().toString(); if (l_user == "") { setContentView(R.layout.act_login); } else { if (p_user == "") { setContentView(R.layout.act_login); } else { // код отправки данных из форм на сервер This method of checking for filling for some reason does not work correctly. If both fields are empty, then everything works, and if you enter a letter in one of the fields, the script starts sending a request. But it should not, because the second field is empty!
The code shows that if at least one of the fields is empty, the screen with the same registration form is loaded, but, as I said, the check does not work well.
How to make a check on the number of characters entered in the EditText field?
==without good reason? - Regent"".equals(l_user), which checks for emptiness will returnfalse, even whenl_user == null. - Lex Hobbit