Android Crashes while using negative number

102 Views Asked by At

In my application, I am getting a number that should be greater than zero to proceed with further steps. That value is coming from service. Sometimes it will be negative or zero from service response. So I am checking it with the below code but the app crashes when it is a negative value. The crash happens at the line

if(expiry_num>0)

. Please help me on this

String expiry =StatusInfo.get("Minutes").toString();
           int expiry_num = Integer.parseInt(expiry);
            if (expiry_num>0) {


                    DetailsHandling();
                }
0

There are 0 best solutions below