I am looking for a way to limit the numbers I enter into the EditText field, but I am encountering some obstacles.
I have already thoroughly researched for a solution to my problem, which I will define specifically below.
I want to create 4 different EditText fields in which each accepts the following ranges: (1, 24); (80, 200); (1, 999); (40, 70).
These, for simplicity, will not be decimals (or doubles/floats/longs) but only integers.
I have looked into the solutions provided by the following links, and have provided their shortcomings.
Android: Limiting EditText to numbers This solution only tells me how to limit the entered text to numerical data only. It does not provide ranges.
Is there a way to define a min and max value for EditText in Android? The accepted solution does accomplish the goal of setting the range, but the problem is that it only works for the ranges (1, 24) and (1, 999) due to its implementation. The problem is that if I look for values in the intervals (40, 70) or (80, 200), I will start by entering one digit at a time, so this does not work. It will deny the single digit input, which makes it non-user friendly.
How to limit the text in numbers only from 0-59 in Edit Text in Android? I believe the accepted solution here has the same problem as the one above, since it takes one digit at a time. I considered using the same method under afterTextChanged instead on onTextChanged, but to no avail.
Number range on an edittext - only want numbers between 1 and 10 This solution involves a button click to evaluate whether the number falls in the given range, so this would be considered an "after-the-fact" solution. I need an EditText that rejects the user's input in real time.
Your assistance is greatly appreciated and will probably help resolve the problems that many others have apparently had (reading the comments, others seem to want ranges that don't start/end in single-digit numbers).