0

I am using creating a barcode analyzer for android using eclipse and am breaking down the barcode string. However, the following block of code keeps crashing the app

appID = istring.substring(0, 4);
        nep = 4;
        if (appID != "8110") {
            couponERROR = 1;
        } else {
            if (istring.length() < nep + 1) {
                couponERROR = 1;
                couponERROR);
            } else {
                coprefixVLI1stString = istring.substring(nep, nep + 1);
                coprefixVLI1st = Integer.parseInt(coprefixVLI1stString);
                nep++;

I'm fairly new to Java but have experience in objective c. Any help would be greatly appreciated. Thanks

Chip Cary
  • 65
  • 1
  • 1
  • 10
  • 1
    What is the error? Post a stacktrace. – chAmi May 28 '14 at 16:38
  • 3
    appID != "8110" --> http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java – kupsef May 28 '14 at 16:41
  • what is the error and the line of the error? – Dyna May 28 '14 at 16:41
  • changing appID != "8110" to (!(appID.equals("8110")) fixed it. if you would like to post that as an answer. I'll gladly accept it. – Chip Cary May 28 '14 at 16:49
  • With as many times as I have seen this type of question, you would think that the first 2 weeks of any java class or 2 chapters of any java book would just repeat, "Only primitive types can be compared with ==." – zgc7009 May 28 '14 at 17:55

0 Answers0