android.widget.AutoCompleteTextView.setError()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中android.widget.AutoCompleteTextView.setError()方法的一些代码示例,展示了AutoCompleteTextView.setError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AutoCompleteTextView.setError()方法的具体详情如下:
包路径:android.widget.AutoCompleteTextView
类名称:AutoCompleteTextView
方法名:setError

AutoCompleteTextView.setError介绍

暂无

代码示例

代码示例来源:origin: vekexasia/android-edittext-validator

/**
 * Resolve an issue where the error icon is hidden under some cases in JB
 * due to a bug http://code.google.com/p/android/issues/detail?id=40417
 */
@Override
public void setError(CharSequence error, Drawable icon) {
  super.setError(error, icon);
  lastErrorIcon = icon;
  // if the error is not null, and we are in JB, force
  // the error to show
  if (error != null /* !isFocused() && */) {
    showErrorIconHax(icon);
  }
}

代码示例来源:origin: zulip/zulip-android

private void removeEditTextErrors() {
  streamActv.setError(null);
  topicActv.setError(null);
  messageEt.setError(null);
}

代码示例来源:origin: termux/termux-tasker

@Override
  public void afterTextChanged(Editable editable) {
    final String currentValue = editable.toString();
    for (String s : fileNames) {
      if (s.equals(currentValue)) {
        mExecutableText.setError(null);
        return;
      }
    }
    mExecutableText.setError("No such file");
  }
});

代码示例来源:origin: ecgreb/mvpc

@Override public void clearAllErrors() {
 mEmailView.setError(null);
 mPasswordView.setError(null);
}

代码示例来源:origin: TUM-Dev/Campus-Android

private void onError() {
  searchView.setError(getString(R.string.error_user_not_found));
}

代码示例来源:origin: ecgreb/mvpc

@Override public void showEmailError(ErrorType errorType) {
 switch (errorType) {
  case EMPTY:
   mEmailView.setError(getContext().getString(R.string.error_field_required));
   break;
  case INVALID:
   mEmailView.setError(getContext().getString(R.string.error_invalid_email));
   break;
 }
 mEmailView.requestFocus();
}

代码示例来源:origin: TUM-Dev/Campus-Android

@Override
public void onResponse(@NonNull Call<List<ChatMember>> call,
            @NonNull Response<List<ChatMember>> response) {
  searchView.setError(null);
  suggestions = response.body();
  ((MemberSuggestionsListAdapter) searchView.getAdapter()).updateSuggestions(suggestions);
}

代码示例来源:origin: TUM-Dev/Campus-Android

searchView.setError(getString(R.string.error_invalid_tum_id_format));
} else {
  searchView.setError(null);

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Override
  public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
    if (id == R.id.login || id == EditorInfo.IME_NULL) {
      Log.i(TAG, "OnEditorActionListener id:" + id + " keyEvent" + keyEvent.toString());
      userName.setError(null);
      pass.setError(null);
      validator.validate(); //Async();
      // return true;  //this will keep keyboard open
    }
    return false;
  }
});

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Click
void clientLoginButton() {
  Log.i(TAG, "clientLoginButton");
  submitButton.setClickable(false);
  if (validator != null) {
    userName.setError(null);
    pass.setError(null);
    validator.validate();
  }
}

代码示例来源:origin: GetStream/Stream-Example-Android

mEmailView.setError(null);
mUsername.setError(null);
  mEmailView.setError(getString(R.string.error_field_required));
  focusView = mEmailView;
  cancel = true;
} else if (!isEmailValid(email)) {
  mEmailView.setError(getString(R.string.error_invalid_email));
  focusView = mEmailView;
  cancel = true;

代码示例来源:origin: tyzlmjj/AndroidUI

mEmailView.setError(null);
mPasswordView.setError(null);
  mEmailView.setError(getString(R.string.error_field_required));
  focusView = mEmailView;
  cancel = true;
} else if (!isEmailValid(email)) {
  mEmailView.setError(getString(R.string.error_invalid_email));
  focusView = mEmailView;
  cancel = true;

代码示例来源:origin: brainysoon/cyberCar

private boolean checkBeforeLogin(String userName, String userPassword) {
  //检验账户
  if (!(CheckUserInfo.isAccount(userName) ||
      CheckUserInfo.isEmail(userName) ||
      CheckUserInfo.isMobile(userName))) {
    mUserName.setError("亲,有点不对哦!");
    return false;
  }
  //校验密码
  if (!CheckUserInfo.checkPassword(userPassword, mUserPassword)) {
    return false;
  }
  return true;
}

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Override
public void onValidationFailed(List<ValidationError> errors) {
  if (errors != null) {
    StringBuilder toastMessage = new StringBuilder();
    for (ValidationError error : errors) {
      if (error != null && error.getView() != null) {
        error.getView().requestFocus();
        List<Rule> failedRules = error.getFailedRules();
        if (failedRules != null) {
          for (Rule rule : failedRules) {
            if (error.getView() instanceof EditText) {
              ((EditText) error.getView()).setError(rule.getMessage(mActivity));
            } else if (error.getView() instanceof AutoCompleteTextView) {
              ((AutoCompleteTextView) error.getView()).setError(rule.getMessage(mActivity));
            } else {
              toastMessage.append(rule.getMessage(mActivity)).append("\n");
            }
          }
        }
      }
    }
    if (toastMessage.length() > 0)
      Toast.makeText(mActivity, toastMessage.toString(), Toast.LENGTH_SHORT).show();
  }
}

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Override
public void onValidationFailed(List<ValidationError> errors) {
  if (errors != null) {
    StringBuilder toastMessage = new StringBuilder();
    for (ValidationError error : errors) {
      if (error != null && error.getView() != null) {
        error.getView().requestFocus();
        List<Rule> failedRules = error.getFailedRules();
        if (failedRules != null) {
          for (Rule rule : failedRules) {
            if (error.getView() instanceof EditText) {
              ((EditText) error.getView()).setError(rule.getMessage(mActivity));
            } else if (error.getView() instanceof AutoCompleteTextView) {
              ((AutoCompleteTextView) error.getView()).setError(rule.getMessage(mActivity));
            } else {
              toastMessage.append(rule.getMessage(mActivity)).append("\n");
            }
          }
        }
      }
    }
    if (toastMessage.length() > 0)
      Toast.makeText(mActivity, toastMessage.toString(), Toast.LENGTH_SHORT).show();
  }
  submitButton.setClickable(true);
}

代码示例来源:origin: zadr50/Gojek

mNamaView.setError(null);
mPasswordView.setError(null);
mHandphoneView.setError(null);

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

if (start == null) {
  if (starting.getText().length() > 0) {
    starting.setError("Choose location from dropdown.");
  } else {
    Toast.makeText(this, "Please choose a starting point.", Toast.LENGTH_SHORT).show();
    destination.setError("Choose location from dropdown.");
  } else {
    Toast.makeText(this, "Please choose a destination.", Toast.LENGTH_SHORT).show();

代码示例来源:origin: SkyTreasure/Airbnb-Android-Google-Map-View

if (start == null) {
  if (starting.getText().length() > 0) {
    starting.setError("Choose location from dropdown.");
  } else {
    Toast.makeText(this, "Please choose a starting point.", Toast.LENGTH_SHORT).show();
    destination.setError("Choose location from dropdown.");
  } else {
    Toast.makeText(this, "Please choose a destination.", Toast.LENGTH_SHORT).show();

代码示例来源:origin: sytolk/TaxiAndroidOpen

@Click
void sendButton() {
  if (validator != null) {
    userName.setError(null);
    pass.setError(null);
    cityName.setError(null);
    phoneNumber.setError(null);
    email.setError(null);
    validator.validate();
  }
}

代码示例来源:origin: zaynr/Carpool-Android-Client

@Override
  public void onClick(View view) {
    if (TextUtils.isEmpty(destAuto.getText())) {
      destAuto.setError("请输入终点");
      destAuto.requestFocus();
      return;
    }
    if(destLatlng==null){
      Toast.makeText(getApplicationContext(), "未搜索到终点位置", Toast.LENGTH_SHORT).show();
      return;
    }
    placeOrder.setClickable(true);
    mBaiduMap.clear();
    mSearchRoute.drivingSearch((new DrivingRoutePlanOption())
        .from(PlanNode.withLocation(oriLatlng)).to(PlanNode.withLocation(destLatlng)));
  }
});

相关文章

AutoCompleteTextView类方法