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

java.lang.NumberFormatException: For input string: "" #312

Closed RameshbabuJaga closed 5 years ago

RameshbabuJaga commented 5 years ago

Hi there, am using this lib and getting the above error when i am passing this mobile number +91 987654321. I don't know why substring indexing throwing null string.

java.lang.NumberFormatException: For input string: "" at java.lang.Integer.parseInt(Integer.java:620) at java.lang.Integer.parseInt(Integer.java:643) at com.hbb20.CCPCountry.getCountryForNumber(CCPCountry.java:344) at com.hbb20.CountryCodePicker.setFullNumber(CountryCodePicker.java:1766) at com.app.app.Activities.ProfileActivity$3.onResponse(ProfileActivity.java:222) updateFormattingTextWatcher: EditText not registered CCP_last_selection EditText for carrier number is not registered. Register it using registerCarrierNumberEditText() before getFullNumber() or setFullNumber().

hbb20 commented 5 years ago

It looks like you have not registered carrierNumberEditText. You can set the edit text using registerCarrierNumberEditText(). For more details, check wiki page.