I need to change background color of EditText if it is empty.
Below is my code but doesn’t seem to be working.
public void onClick(View v) {
// TODO Auto-generated method stub
Change();
}
public void Change() {
if(("").equals(name)) {
name.setBackgroundColor(Color.RED);
return;
}
}
The easiest way is to check the length: