i have error in edit cart item in my app.the error is : java.lang.NumberFormatException: For input string: \"null\"
.i thing error line interget.parseInt(\"\"
The java.lang.NumberFormatException
comes when you try to parse a non-numeric String
to any Number like Integer
or Double
.
For example, if you try to convert "null"
to an integer
then you will get NumberFormatException
.
The error "Exception in thread "main" java.lang.NumberFormatException:
For input string: "null" is specifically saying that the String you receive for parsing is not numeric.
Please ensure v.getTag()
is not null before parsing.
String input = v.getTag();
If( null != input )
{
int updatePos = Integer.parseInt("" + input);
}
check XML and ensure that all of your Views have this attribute: android:tag="someTag"
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tag="someTag"/>