Closed dleonett closed 5 years ago
Thank you for the issue and the code for fixing the problem! I have updated the library in https://github.com/joielechong/CountryCodePicker/commit/1466aec75b6ad79bf03ad72583de2cb98ae918b9 commit.
Please take a look if the problem have been solved on https://github.com/joielechong/CountryCodePicker/blob/master/release/sample-debug.apk
And sorry for the late response :(.
When selecting a new country code, the phone number formatting is not being updated.
After some research into library code, I found out the issue is because even though
mPhoneNumberWatcher
gets updated with a new instance, it is not being added again totextView
as a TextWatcher.From library code:
Please note that just assigning a new value to
mPhoneNumberWatcher
won't update the object withintextView
listeners list.Please refer to: https://stackoverflow.com/questions/7080546/add-an-object-to-an-arraylist-and-modify-it-later
Possible solution
We should remove previous
mPhoneNumberWatcher
and then add the new instance usingtextView.addTextChangedListener(mPhoneNumberWatcher)
to properly update the phone number format according to the new selected country.