当前位置: 首页>>代码示例>>Java>>正文


Java TextInputLayout.setError方法代码示例

本文整理汇总了Java中android.support.design.widget.TextInputLayout.setError方法的典型用法代码示例。如果您正苦于以下问题:Java TextInputLayout.setError方法的具体用法?Java TextInputLayout.setError怎么用?Java TextInputLayout.setError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.design.widget.TextInputLayout的用法示例。


在下文中一共展示了TextInputLayout.setError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkEmail

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean checkEmail(EditText emailEditText, TextInputLayout emailInputLayout) {
    if (emailEditText.getText().toString().trim().isEmpty()) {
        emailInputLayout.setErrorEnabled(true);
        emailInputLayout.setError(getString(R.string.error_no_email));
        if (emailEditText.requestFocus()) {
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
        return false;
    } else {
        if (android.util.Patterns.EMAIL_ADDRESS.matcher(emailEditText.getText().toString()).matches()) {
            emailInputLayout.setErrorEnabled(false);
        } else {
            emailInputLayout.setErrorEnabled(true);
            emailInputLayout.setError(getString(R.string.error_no_email));
            if (emailEditText.requestFocus()) {
                getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
            return false;
        }
    }
    return true;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:23,代码来源:LoginActivity.java

示例2: onClick

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
    TextInputLayout tilUsername = (TextInputLayout) findViewById(R.id.TILUsername);
    TextInputLayout tilPassword = (TextInputLayout) findViewById(R.id.TILPassword);

    final String strUsername = etUsername.getText().toString();
    final String strPassword = etPassword.getText().toString();

    if (v.equals(btnLogin)){
        if (strUsername.equals("")){
            tilUsername.setError("Kullanıcı adı boş olamaz.");
        }else if (strPassword.equals("")){
            tilPassword.setError("Parola adı boş olamaz.");
        }else{

            Request request = new Request(this, url, com.android.volley.Request.Method.POST);
            request.requestVolleyAuth(this,  strUsername,  strPassword);
            progressDialog = new ProgressDialog(this);
            progressDialog.setMessage("Giriş Yapılıyor..");
            progressDialog.show();

        }
    }
}
 
开发者ID:yusufcakal,项目名称:RestaurantApp,代码行数:25,代码来源:StaffLoginActivity.java

示例3: isInputEditTextMatches

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public boolean isInputEditTextMatches(TextInputEditText textInputEditText1, TextInputEditText textInputEditText2, TextInputLayout textInputLayout, String message) {
    String value1 = textInputEditText1.getText().toString().trim();
    String value2 = textInputEditText2.getText().toString().trim();
    if (!value1.contentEquals(value2)) {
        textInputLayout.setError(message);
        hideKeyboardFrom(textInputEditText2);
        return false;
    } else {
        textInputLayout.setErrorEnabled(false);
    }
    return true;
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:13,代码来源:InputValidation.java

示例4: checkDocument

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean checkDocument(EditText editText, TextInputLayout textInputLayout) {
    if (editText.getText().toString().trim().isEmpty()) {
        textInputLayout.setErrorEnabled(true);
        textInputLayout.setError(getString(R.string.error_no_dni));
        if (editText.requestFocus()) {
            getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
        }
        return false;
    } else {
        textInputLayout.setErrorEnabled(false);
    }
    return true;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:14,代码来源:LoginActivity.java

示例5: validateAccount

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validateAccount() {
    TextInputLayout accountInputLayout = (TextInputLayout) fragmentView.findViewById(R.id.account_input_layout);
    EditText accountEditText = (EditText) fragmentView
            .findViewById(R.id.account_edittext);
    String accountText = accountEditText.getText().toString();
    if (TextUtils.isEmpty(accountText)) {
        accountInputLayout.setError(getString(R.string.account_empty_error_message));
        requestFocus(accountEditText);
        return false;
    } else {
        accountInputLayout.setErrorEnabled(false);
    }
    return true;
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:15,代码来源:AccountSettingFragment.java

示例6: titleButtonListener

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public void titleButtonListener(View v) {
    EditText title = (EditText) findViewById(R.id.title_input);
    TextInputLayout titleLayout = (TextInputLayout) findViewById(R.id.title_input_layout);
    if (title.getText().length() == 0) {
        titleLayout.setError(getString(R.string.must_insert_issue_title));
    } else {
        title.setError(null);
        mTitle = title.getText().toString();
        nextPage();
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:12,代码来源:CreateIssueActivity.java

示例7: textInputErrorTwinkle

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public static void textInputErrorTwinkle(TextInputLayout il, String str) {
    String error = (String) il.getError();
    if (TextUtils.isEmpty(error)) {
        error = TextUtils.isEmpty(str) ? "!" : str;
    }

    il.setErrorEnabled(false);
    il.setError(error);
    il.setErrorEnabled(true);
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:11,代码来源:TextInputHelper.java

示例8: setError

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public static void setError(TextInputLayout til, @Nullable String error,
		boolean set) {
	if (set) {
		if (til.getError() == null) til.setError(error);
	} else {
		til.setError(null);
	}
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:9,代码来源:UiUtils.java

示例9: validatePassword

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validatePassword() {
    TextInputLayout passwordInputLayout = (TextInputLayout) fragmentView.findViewById(R.id.password_input_layout);
    EditText passwordEditText = (EditText) fragmentView
            .findViewById(R.id.password_edittext);
    String passwordText = passwordEditText.getText().toString();
    if (TextUtils.isEmpty(passwordText)) {
        passwordInputLayout.setError(getString(R.string.password_empty_error_message));
        requestFocus(passwordEditText);
        return false;
    } else {
        passwordInputLayout.setErrorEnabled(false);
    }
    return true;
}
 
开发者ID:kamisakihideyoshi,项目名称:TaipeiTechRefined,代码行数:15,代码来源:AccountSettingFragment.java

示例10: isInputEditTextFilled

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
/**
 * method to check InputEditText filled .
 *
 * @param textInputEditText
 * @param textInputLayout
 * @param message
 * @return
 */
public boolean isInputEditTextFilled(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message) {
    String value = textInputEditText.getText().toString().trim();
    if (value.isEmpty()) {
        textInputLayout.setError(message);
        hideKeyboardFrom(textInputEditText);
        return false;
    } else {
        textInputLayout.setErrorEnabled(false);
    }

    return true;
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:21,代码来源:InputValidation.java

示例11: setError

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
public static void setError(TextView textView, String errorMessage) {
    TextInputLayout textInputLayout = getTextInputLayout(textView);
    if (textInputLayout != null) {
        textInputLayout.setErrorEnabled(!TextUtils.isEmpty(errorMessage));
        textInputLayout.setError(errorMessage);
    } else {
        textView.setError(errorMessage);
    }
}
 
开发者ID:Ilhasoft,项目名称:data-binding-validator,代码行数:10,代码来源:EditTextHandler.java

示例12: doRenameBook

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void doRenameBook(Book book, String name, TextInputLayout inputLayout) {
    if (!TextUtils.isEmpty(name)) {
        inputLayout.setError(null);
        mSyncFragment.renameBook(book, name);

    } else {
        inputLayout.setError(getString(R.string.can_not_be_empty));
    }
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:10,代码来源:MainActivity.java

示例13: validateInputs

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private boolean validateInputs() {
    boolean valid = true;
    // Validates title (required field, ensure title is given.)
    TextInputLayout titleWrapper = getView().findViewById(R.id.edit_title_wrapper);
    TextInputEditText title = getView().findViewById(R.id.edit_title);

    if (title.getText().toString().isEmpty()) {
        titleWrapper.setErrorEnabled(true);
        titleWrapper.setError("This field is required.");
        title.requestFocus();
        myActivity.hideSoftKeyboard(false);
        valid = false;
    } else {
        titleWrapper.setError(null);
        titleWrapper.setErrorEnabled(false);
    }

    // Validates due_date (must be later than now.)
    TextInputLayout timeWrapper = getView().findViewById(R.id.edit_time_wrapper);
    TextInputEditText time = getView().findViewById(R.id.edit_time);
    long date_time = myCalendar.getTimeInMillis();
    long current_date_time = System.currentTimeMillis();
    if (date_time < current_date_time){
        timeWrapper.setErrorEnabled(true);
        timeWrapper.setError("Please select a time later than now");
        time.requestFocus();
        valid = false;
    } else {
        time.setError(null);
        timeWrapper.setErrorEnabled(false);
    }

    return valid;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:35,代码来源:ToduleAddFragment.java

示例14: setErrorStyle

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
private void setErrorStyle(EditText editText, TextInputLayout textInputLayout, int idMessage) {
    textInputLayout.setErrorEnabled(true);
    textInputLayout.setError(getString(idMessage));
    requestFocus(editText);
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:6,代码来源:ProfileActivity.java

示例15: setErrorText

import android.support.design.widget.TextInputLayout; //导入方法依赖的package包/类
/**
 * Facilitates binding error text to a TextInputLayout.
 */
@BindingAdapter("errorText")
public static void setErrorText(TextInputLayout layout, String errorText) {
    layout.setError(errorText);
}
 
开发者ID:openid,项目名称:OpenYOLO-Android,代码行数:8,代码来源:DataBindingAdapters.java


注:本文中的android.support.design.widget.TextInputLayout.setError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。