NumberFormatException

后端 未结 2 1229
面向向阳花
面向向阳花 2021-01-26 01:13

I\'m trying to develop an app that will take a number from the dial pad and call another number instead. But i get a number format exception on the phonenumber i want to call. <

2条回答
  •  长发绾君心
    2021-01-26 01:53

    That's because 6768886877 is too big of a number for an int.

    Use a long instead.

    long checkNumber = 0l;
    
    try{
      checkNumber = Long.parseLong (phoneNumber);
    }
    catch (NumberFormatException e)
    {
      e.printStackTrace();
    }
    

提交回复
热议问题