java.lang.NumberFormatException: Invalid int: ""的解决方法

java.lang.NumberFormatException: Invalid int: ""不能成功转成int类型

错误代码:

private int allCount; String temp = null; allCount = Integer.parseInt(temp);

 

更改代码(添加try catch使之兼容性增强):

 

try { String temp = null; allCount = Integer.parseInt(temp); } catch (Exception e) { allCount = 200; }

 

你可能感兴趣的:(Android)