EditText recEmail=(EditText)findViewbyId(R.id.email);
EditText recPassword=(EditText)findViewbyId(R.id.password);
String email=recEmail.getText().toString();
String password=recPassword.getText().toString();
The email and password contains the white spaces at start,in or end of string if tab is pressed by mistake.
I need text out of white spaces, please help if you can.
Thanks in advance….!!!
String.trim() is your friend.
In the future, I highly recommend checking the Java String methods in the API. It’s a lifeline to getting the most out of your Java environment.
As a general rule, I would not get rid of whitespace in the text. What if the user’s password starts or ends with a space? They will never be able to log in. I personally think you’re better off just leaving your code as is.