joielechong / CountryCodePicker

Country Code Picker (CCP) is an android library which provides an easy way to search and select country phone code ( national code ) for the telephone number.
Apache License 2.0
315 stars 143 forks source link

Edittext hint changes when using registerPhoneNumberTextView() #64

Closed karanjhinga closed 5 years ago

karanjhinga commented 5 years ago

whenever i am using registerPhoneNumberTextView() on country code picker view hint text changes. it changes hint to 081234 56789.

joielechong commented 5 years ago

It's because the default selected country in ccp is Indonesia. So, the hint is correct.

You need to set the default select country code with ccp_defaultNameCode attribute. For example: to make Argentina as the default country, add ccp_defaultNameCode="ar". Something like this:

  <com.rilixtech.widget.countrycodepicker.CountryCodePicker
      android:id="@+id/ccp"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      app:ccp_hideNameCode="false"
      app:ccp_hidePhoneCode="false"
      app:ccp_defaultNameCode="ar"
      app:ccp_keyboardAutoPopOnSearch="false"
      app:ccp_showFullName="false"
      />

The country code is Alpha-2 code from ISO_3166-1. See https://en.wikipedia.org/wiki/ISO_3166-1