I have to check the consistency of some fields in my application, but I can not get the process to stop for the user to enter the correct information. The way I put it, the error message is displayed but processing continues, see the commands below. What should I do?
InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
if (rendim.getText().toString().isEmpty())
{
rendim.setError("Preencha o salário");
rendim.requestFocus();
imm.showSoftInput(rendim, InputMethodManager.SHOW_IMPLICIT);
}
else
{
objVal_or = new Val_or();
rendimento = objVal_or.va_lor(rendim.getText().toString());
if (rendimento <= 0)
{
rendim.setError("Salário zerado");
rendim.requestFocus();
imm.showSoftInput(rendim, InputMethodManager.SHOW_IMPLICIT);
}
}