hbb20 / CountryCodePickerProject

Country Code Picker (CCP) is an android library which provides an easy way to search and select country or international phone code. Also supports Android EditText phone mask and international phone validation.
Apache License 2.0
1.52k stars 506 forks source link

W/System.err: java.lang.NumberFormatException: For input string: "" #331

Closed tsvelichkov closed 5 years ago

tsvelichkov commented 5 years ago

W/System.err: java.lang.NumberFormatException: For input string: "" W/System.err: at java.lang.Integer.parseInt(Integer.java:627) at java.lang.Integer.parseInt(Integer.java:650) at com.hbb20.CCPCountry.getCountryForNumber(CCPCountry.java:344) at com.hbb20.CountryCodePicker.setFullNumber(CountryCodePicker.java:1766) at com.rentila.landlord.fragments.TenantEditFragment$TenantEditPageFragment.onCreateView(TenantEditFragment.java:499) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2439) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460) at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784) at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852) at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:802) at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625) W/System.err: at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)

The phone number is: +359888858888

Investigating the library code it seems like the loop for getCountryForNumber is trying to cast "" to integer on the first iteration.

The field is populated ok. It is just the exception showing in the log

hbb20 commented 5 years ago

Thank you for reporting. We just released new version v2.3.0 with the fix. Please check and let us know if it does not work as expected.