Created
December 8, 2019 14:59
-
-
Save AliAzaz/76e39fa04b666b768a497dc3ec74f823 to your computer and use it in GitHub Desktop.
Old validating method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Empty edittext checking | |
if (txtbox1.getText().toString().isEmpty()) { | |
txtbox1.setError("This data is Required!"); | |
return false; | |
} else { | |
txtbox1.setError(null); | |
} | |
//Equal/Pattern edittext checking | |
if (!txtBoxDefault.isTextEqualToPattern()) | |
return; | |
//RadioGroup Checking | |
if (mnc2.getCheckedRadioButtonId() == -1) { | |
mnc2a.setError(getString(R.string.txterr)); | |
Toast.makeText(getApplicationContext(), "ERROR(empty): " + getString(R.string.mnc2), Toast.LENGTH_LONG).show(); | |
Log.i(TAG, "mnc2: This Data is Required!"); | |
mnc2a.requestFocus(); | |
return false; | |
} else { | |
mnc2a.setError(null); | |
} | |
//MultiCheckbox Checking | |
if (!mnf1a.isChecked() && | |
!mnf1b.isChecked() && | |
!mnf1c.isChecked() && | |
!mnf1d.isChecked() && | |
!mnf1e.isChecked() && | |
!mnf1f.isChecked() && | |
!mnf1g.isChecked() && | |
!mnf1h.isChecked() && | |
!mnf188.isChecked()) { | |
mnf1a.setError(getString(R.string.txterr)); | |
Toast.makeText(getApplicationContext(), "ERROR(empty): " + getString(R.string.mnf1), Toast.LENGTH_LONG).show(); | |
Log.i(TAG, "mnf1a: This Data is Required!"); | |
mnf1a.requestFocus(); | |
return false; | |
} else { | |
mnf1a.setError(null); | |
} | |
//other checkbox checking | |
if (mnf188.isChecked()) { | |
if (mnf1x.getText().toString().isEmpty() || mnf1x.getText().toString() == null) { | |
mnf1x.setError(getString(R.string.txterr)); | |
Toast.makeText(getApplicationContext(), "ERROR(empty): " + getString(R.string.others), Toast.LENGTH_LONG).show(); | |
Log.i(TAG, "mnf1x: This Data is Required!"); | |
mnf1x.requestFocus(); | |
return false; | |
} else { | |
mnf1x.setError(null); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment