I am making an app where user must enter basic info about self.First name,second name, city and quantity that he or she wish to order.If he or she skip one field toast will pop up with message what field is skipped. And that is ok.That works but if he skip quantity field I got error on my phone and it send user back on previously activity.When I inspect my LogCat I see error message . Now I know why that message appears.Because it expected to find Integer, if statment. but actually finds String. But do not know how to fix it.The last if/else statemen is an Issue:
Now what i tried so far:
1) Tried to set primitive int as object Integer
2)Tried to use kolicina==0;
3)Tried to use kolicina.equals(null) / kolicina.equals(0);
4)Tried to use .isEmty();
which, looking at the method, seems to be checking the field isn't empty.
However you do nothing with the boolean result.
In fact, the check done inside there seems to be incorrect (and EditText will never be equal to a test string for example).
It looks to me like you should be correcting that method so it checks the values actually exist, and then do something with the return result.
That is, if it returns false then pop up the toast and exit. If true, then continue to check the rest of the fields. If all true then (and only then) deal with the data.
Currently you only validate after you start using the data.