I have 3 edittexts with input type as number and 1 button that say Done
I have to check two conditions for the values entered in the edittexts
When I click on the button Done I should be able to do thee following things
—-First is to check if the edit texts are empty or not
if ((a.getText().toString().equals("")) || (b.getText().toString().equals("")) || (c.getText().toString().equals("")))
Toast.makeText(getApplicationContext(), "Don't leave grade points empty",0).show();
—-Second is to check if the values entered are within a certain range
if((a1<5 || a1>10)||(b1<5 || b1>10)||(c1<5 || c1>10))
Toast.makeText(getApplicationContext(), "Range should be between 15 to 25", 0).show();
both a,b,c and a1,b1,c1 represent the same values, i’ve just parsed the values of a,b,c to int in a1,b1,c1
—-Then in the else part I should be able to use these values if they pass the above conditions.
else
{
//do something
}
My problem is how to make it work as I face a Force close error on clicking the Done button when all 3 edittext are empty. I tried to put those in if, else if and else loop and also tried if,if and else loop.
How should I code that if it doesn’t satisfy both the conditions and then go to the else part?
Help !! 🙂
1 Answer