2016-03-28 50 views
0

我不明白这个异常背后的原因PID:30172 java.lang.NumberFormatException:无效INT: “64”

E/AndroidRuntime﹕ FATAL EXCEPTION: main 
    Process: com.khalid_al_mustadi.jockeystickers, PID: 30172 
    java.lang.NumberFormatException: Invalid int: "64‎" 

所有我做的是

if (Integer.parseInt(groupnameList.get(position).get("Value_C").trim().replace("%", "")) >= 70) 
+1

分隔parseInt内部的内容可能会帮助您确定为什么它无法解析该结果 –

+0

首先尝试调试什么是 - groupnameList.get(position).get(“Value_C”)的值.trim()。replace(“%”,“”) –

回答

0

从日志,似乎您试图解析 -

Integer.parseInt("\"64\"")); 

这意味着groupnameList.get(position).get("Value_C").trim().replace("%", "")给你 - "\"64\"" (a string "64" with the double quotes included)

双引号(“)不能转换为整数,这就是为什么你得到NumberFormatException。 在使用Integer.parseInt()之前删除任何双引号。

相关问题