Customize setError with common function to use it in any actvity.
To clear error from EditText / TextView use this
public void setError(EditText edit,String str){
int resId = this.getResources().getIdentifier(str, "string", this.getPackageName());
String msg = getResources().getString(resId);
edit.setFocusableInTouchMode(true);
edit.requestFocus();
edit.setError(msg);
}
To clear error from EditText / TextView use this
public void clearError(EditText edit){
edit.setError(null);
edit.clearFocus();
}
0 comments:
Post a Comment