Set error message in edittext android

Set error message in edittext android

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

Step 1

Create button and implement onClickListener.

btnLogin.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub

Step 2

Validate the input fields and set the error in the input field.

        Toast.makeText(getApplicationContext(), "Login success", Toast.LENGTH_SHORT).show();
        edNumber.setError("Number Mininum length is 4");
    edName.setError("Name Mininum length is 4");


velmm download code

Leave a Reply

Your email address will not be published. Required fields are marked *