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. <
2156689451
is too big for an int (which range from -2^31≈-2,147E9 to +2^31-1≈2,147E9, whereas your number is ~2,15E10)
Use long
instead of int
...
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();
}