In register activity, focus the email EditTextField(not autocompletext just edittext), I can put the email that I use frequently.
but it always input email with white space.
Like, if frequently using email is 'tester@test.com'
but when I select the email at keyboard, it input with whitespace 'tester@test.com '
I want remove the white space when I select the email with autocomplete
If you know about that, please help me
I put this at public void afterTextChanged(Editable s)
Log.d(TAG,"print input email " + "|" + editTextEmail.getText().toString() + "|");
D/JoinActivity: print input email |tester@tester|
D/JoinActivity: print input email |tester@tester|
D/JoinActivity: print input email |tester@tester |
when I put in after textchanged,
It print repeat like this,
2019-03-13 17:55:31.208 24374-24565/? D/InputTransport: Input channel constructed: fd=418
2019-03-13 17:55:31.208 24374-24565/? D/InputTransport: Input channel destroyed: fd=418
2019-03-13 17:55:31.208 14842-14842/com.example.thewell_dev.myapplication D/InputTransport: Input channel constructed: fd=79
2019-03-13 17:55:31.209 14842-14842/com.example.thewell_dev.myapplication D/InputTransport: Input channel destroyed: fd=82
2019-03-13 17:55:31.217 14842-14842/com.example.thewell_dev.myapplication V/InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@8a6ddd0 nm : com.example.thewell_dev.myapplication ic=com.android.internal.widget.EditableInputConnection@58201c9
Try this
inside your editText.addTextChangedListener{....}
add this
@Override
public void afterTextChanged(Editable s) {
String result = s.toString().replaceAll(" ", "");
editText.setText(result);
}
OR
@Override
public void afterTextChanged(Editable s) {
String result= s.trim();
editText.setText(result);
}
您可以将TextWatcher添加到EditText中,以监视文本的更改并删除前导/尾随空白。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.