How could I make my four edit boxes total sum never to exceed 100? None of the edit box values or the total sum of the edit boxes should also never go below 0.
Asked
Active
Viewed 58 times
0
-
How about printing an error message if the sum conditions are violated? – George Tomlinson Feb 13 '14 at 11:30
-
textwatcher is your friend... and also maybe check some "losing focus" functions... You need to come up with lgic to divide 100 between 3 boxes/numbers.. – TheLostMind Feb 13 '14 at 11:30
-
@TheLostMind - I know how to do it between two boxes, but now when it's four I'm totally stuck. – user2481390 Feb 13 '14 at 11:43
-
@user2481390 - first comeup with an algorithm to efficiently divide the 4 numbers to form a sum of 100... for example if you enter 90 in the first box, you should be allowed to enter anything between 1 and 8 in the second.. I think you get the point.. The android part is just puting your logic in a textwatcher and focus based functions.. – TheLostMind Feb 13 '14 at 12:07
-
@TheLostMind - I'm not using android, so I do not know what a textwatcher is or focus based functions... – user2481390 Feb 13 '14 at 12:44
-
@user2481390 - oops... :).. – TheLostMind Feb 13 '14 at 13:22