I know this is very simple question,I am new to android
for example: There are two edit text we can show hint like username and password if user doesn't enter anything then I want to show error message in place of Hint means inside the edit text .
I have google but I got the tutorial where error message is floating on the tip or below . please guide me to show error message inside the edit text.
Asked
Active
Viewed 112 times
0

Ext1 Dev
- 33
- 2
- 6
-
use hint and change hint color to red enter your number * – Atif AbbAsi Oct 05 '18 at 04:43
3 Answers
0
you can try changing the hint dynamically
mEditText.setHint("Enter Proper Data");
additionally, you can also change the color of hint from the java so you can try that.

Urvish rana
- 601
- 10
- 24
0
It's easy to do just change the color of hint
editText.setHintTextColor(Color.RED);
editText.setHint("Error HINT");

Faysal Ahmed
- 7,501
- 5
- 28
- 50

Artem
- 303
- 2
- 9
0
You can do like following and can also add the null case too. Where first_name is an editText
if(first_name.getText().length()==0 && first_name.getText().toString().isEmpty())
{
//This is an error message and will show on EditText
first_name.setError("Please Enter First Name");
}
It'll work for you.

ॐ Rakesh Kumar
- 1,318
- 1
- 14
- 24