I am Planning to implement a form validation in android. I have done empty field validation using the below code.(for Edit Text mTitleText )
mTitleText.setOnFocusChangeListener(this);
@Override
public void onFocusChange(View v, boolean hasFocus) {
if( mTitleText.getText().toString().length() == 0 )
mTitleText .setError( "This Fieid should not be empty " );
}
}
But the problem is that even when the form page is opened it shows error due to empty field.
Seethe picture. Is there any thing other than onfocus change that i can use?
http://imageshack.us/photo/my-images/507/screenshotsd.png/
set
at form page load (means onResume)
and update it