How to Show Error Message in EditText

To showing a error message in the edit text is really simple actually.To done this you have to first create a reference variable in android as indicated downwards

EditText editrefer= findViewById(R.id.edittextname);

Then you have to call an function i.e. setError() function. It accepts only one parameters that is of the string type

setError("");

The string will be the message you want to display like i have create a string as

String errormsg=new String("Enter 10 digit Number");

setError(errormsg);

To apply it on edittext you have to call this function on the edit text variable i.e  editrefer 

editrefer.setError(errormsg);



Comments

Popular posts from this blog

Making Bootable Pendrive with .bat file

Ek Beej Tha Gaya Bahut Hee Gaharaee Mein Boya - Nanha Paudha

R-W-W (Real, Win, Worth it ) - Boost your idea