补充前面博客的邮箱边输边显示提示控件
java代码引用上述控件
mOptionalTip = (AutoCompleteEmailEdit) findViewById(R.id.optional_tip);
mOptionalTip.init();
?mOptionalTip.addTextChangedListener(mTextWatcher);
private TextWatcher mTextWatcher = new TextWatcher() {
??public void afterTextChanged(Editable s) {
??}
??public void beforeTextChanged(CharSequence s, int start, int count,
????int after) {
??}
??public void onTextChanged(CharSequence s, int start, int before,
????int count) {
???if (!TextUtils.isEmpty(s) && s.toString().trim().length() > 0) {
????mOptionalTip.createCandidateEmail(s.toString().trim());
???}
??}
?};
补充TextUtils.isEmpty(s)可以判断空字符串或是空,不能判断空格,s.toString().trim().length() > 0这句用来排除空格
?
?
?