EditText setError() with icon but without Popup message

后端 未结 6 1122
你的背包
你的背包 2020-11-27 03:11

I want to to have some validation for my EditText wherein I want to show \"\" icon (that comes when you put editText.setError(\"blah blah\")) but don\'t want th

6条回答
  •  粉色の甜心
    2020-11-27 04:13

    This is the very useful when you want to show the error messages for the edittext field when the user enter wrong information.this is very simply program only you have to use serError() method in the edittext.

    Step 1: Create button and implement onclickListener.

    btnLogin.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
    // TODO Auto-generated method stub
    }
    });
    

    Step 2: Validate the input fields and set the error in the input field.

    if(edName.length()>3){
    if(edNumber.length()>3){
    Toast.makeText(getApplicationContext(), "Login success", Toast.LENGTH_SHORT).show();
    }else{
    edNumber.setError("Number Mininum length is 4");
    }
    }else{
    edName.setError("Name Mininum length is 4");
    }
    

    Refer this link for more:http://velmuruganandroidcoding.blogspot.in/2014/08/set-error-message-in-edittext-android.html

提交回复
热议问题