Issue
well am able to validate an edittext when its empty using the below code
EditText a = (EditText) findViewById(R.id.edittext1);
if ((a.getText().toString().equals(""))
{
Toast.makeText(getApplicationContext(), "value is empty", 0).show();
}
the edittext input type is set as number.
now i want to validate the number entered.
for example the range of number to be entered should be between 15 to 25.
if the number is below 15 or above 25 it should show Out of Range
help me out! :)
Solution
You can do something like that:
final int value = Integer.valueOf(a.getText().toString());
if (value < 15 || value > 25) {
// do what you want
}
Answered By - thomasg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.