Source:
public void callServerForLogin() { if (!NetworkUtil.isConnected(this)) { showAlertDialog(getString(R.string.no_connectivity), getString(R.string.network_not_connected)); return; } final String emailStr = activityLoginBinding.emailEt.getText().toString().trim(); final String passwordStr = activityLoginBinding.passwordEt.getText().toString().trim(); if (activityLoginBinding.emailEt != null && emailStr.length() == 0) { activityLoginBinding.usernameWrapper.setError(getString(R.string.error_enter_email)); activityLoginBinding.emailEt.requestFocus(); } else if (activityLoginBinding.passwordEt != null && passwordStr.length() == 0) { activityLoginBinding.passwordWrapper.setError(getString(R.string.error_enter_password)); activityLoginBinding.passwordEt.requestFocus(); } else { activityLoginBinding.emailEt.setEnabled(false); activityLoginBinding.passwordEt.setEnabled(false); activityLoginBinding.forgotPasswordTv.setEnabled(false); activityLoginBinding.endUserAgreementTv.setEnabled(false); LoginTask logintask = new LoginTask(this, activityLoginBinding.emailEt.getText().toString().trim(), activityLoginBinding.passwordEt.getText().toString()) { @Override public void onSuccess(@NonNull AuthResponse result) { onUserLoginSuccess(result.profile); } @Override public void onException(Exception ex) { if (ex instanceof HttpStatusException && ((HttpStatusException) ex).getStatusCode() == HttpStatus.BAD_REQUEST) { onUserLoginFailure(new LoginException(new LoginErrorMessage( getString(R.string.login_error), getString(R.string.login_failed))), null, null); } else { onUserLoginFailure(ex, null, null); } } }; tryToSetUIInteraction(false); logintask.setProgressDialog(activityLoginBinding.progress.progressIndicator); logintask.execute(); } }

Target:
public void callServerForLogin() { if (!NetworkUtil.isConnected(this)) { showAlertDialog(getString(R.string.no_connectivity), getString(R.string.network_not_connected)); return; } final String emailStr = activityLoginBinding.emailEt.getText().toString().trim(); final String passwordStr = activityLoginBinding.passwordEt.getText().toString().trim(); if (passwordStr.length() == 0) { activityLoginBinding.passwordWrapper.setError(getString(R.string.error_enter_password)); activityLoginBinding.passwordEt.requestFocus(); } if (emailStr.length() == 0) { activityLoginBinding.usernameWrapper.setError(getString(R.string.error_enter_email)); activityLoginBinding.emailEt.requestFocus(); } if (emailStr.length() > 0 && passwordStr.length() > 0) { activityLoginBinding.emailEt.setEnabled(false); activityLoginBinding.passwordEt.setEnabled(false); activityLoginBinding.forgotPasswordTv.setEnabled(false); activityLoginBinding.endUserAgreementTv.setEnabled(false); LoginTask logintask = new LoginTask(this, activityLoginBinding.emailEt.getText().toString().trim(), activityLoginBinding.passwordEt.getText().toString()) { @Override public void onSuccess(@NonNull AuthResponse result) { onUserLoginSuccess(result.profile); } @Override public void onException(Exception ex) { if (ex instanceof HttpStatusException && ((HttpStatusException) ex).getStatusCode() == HttpStatus.BAD_REQUEST) { onUserLoginFailure(new LoginException(new LoginErrorMessage( getString(R.string.login_error), getString(R.string.login_failed))), null, null); } else { onUserLoginFailure(ex, null, null); } } }; tryToSetUIInteraction(false); logintask.setProgressDialog(activityLoginBinding.progress.progressIndicator); logintask.execute(); } }