我有一个应用程序,其中包含用户输入金额的编辑文本,如果金额不等于零,并且必须大于等于10且小于等于1000,我必须提出条件。但是我收到错误消息。如果字符串不等于null且大于等于10且小于等于1000,如何制定condtiion?
代码: -
if (!hasFocus) {
if (m_szAmount.length()==0 && Integer.parseInt(m_szAmount) < 10 && Integer.parseInt(m_szAmount) > 1000) {
m_InputPointsLayout.setErrorEnabled(true);
m_InputPointsLayout.setError(getResources().getString(R.string.enter_points_error));
} else {
m_InputPointsLayout.setErrorEnabled(false);
m_InputPointsLayout.setError(null);
}
}
产生的原因:java.lang.NumberFormatException:无效INT: “”
我现在想使 – Niraj
你说的相反 –
我收到错误 – Niraj