joielechong/CountryCodePicker

setDefaultCountryUsingNameCode() not working

Closed this issue ยท 7 comments

I am using setDefaultCountryUsingNameCode("US") but still getting Pakistan +92 as the default country. Can someone advise what I may be doing wrong or is it a bug?

Same here โœ‹.

Both Methods are working, I recommend Method 2.

Method 1:
Example:
nationality.setDefaultCountryUsingNameCode("US");
nationality.resetToDefaultCountry();

Method 2:
Example:
You can simply use nationality.setDefaultCountryUsingNameCodeAndApply("US");

Thanks @tahafarooqui! We need to call resetToDefaultCountry() after calling setDefaultCountryUsingNameCode() as in the method documentation.

@ALL: I think I should add a more readable for setting the default country, something like:
setDefaultCountryUsingNameCodeAndApply("US");
how do you think?

I think it's a great idea @joielechong ๐Ÿ‘, make it into two steps (like currently) can confuse some people.

@joielechong Yes, Please. That would be great.

The method has been added in 8b9cd80 commit. But I haven't test it yet.