I'm attempting to check for valid input after the button is pressed using both
string and numerical variables in my If Statements, but apparently they can't coexist or just require extra work.
I can check for a empty string field by using the following code, but I haven't figured out how to check for an empty numerical field:
But then I can't compare the numbers entered with < or > operators because I'm using a string variable, like so:
So, I thought would create a new temp variable using Integer.parseInt(), which would take the number from the original string variable and assign it to the new temp numerical variable, thus allowing me to use the compare operators. It worked, BUT, now my If Conditions using string variables quit working. It seems I can only use one or the other and I don't understand why.
I only created a new variable, and thus kept the original string variable, so why would my If Conditions that are based on string variables quit working?
What is the equivalent of the line below (string variable) to a numeric variable for empty fields, because that is all I need to get this to work?
if (mainColor.getText().toString().equals(""))
I tried the following but cannot get it to work like the string condition above, I always get an error:
if (numMainColor == "")
if (numMainColor == null)
Here is a portion of my code that contains the code in question: