Skip to content

Country Preference

Harsh Bhakta edited this page Oct 1, 2017 · 2 revisions
  • Countries of preference will be listed at the top in selection dialog. It is helpful when the target audience is from a set of countries.

  • The library has a list of countries in alphabetical order. It searches for the country in same order. But preferred country/countries have higher priority than rest.

  • When more than one countries have the same code. For example, Canada, Puerto Rico and the US have +1.

  • If US is set in country preference, order for search will be (1)US-(2)Canada-(3)Puerto Rico, so it will pick the US for +1.

  • Any number of countries can be set in preference.

    • Set through xml

      • Add app:ccp_countryPreference="US,IN,NZ" (replace "US,IN,NZ" with your preference) to xml layout. Refer List of countries for name codes.

         <com.hbb20.CountryCodePicker
          android:id="@+id/ccp"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          app:ccp_countryPreference="US,IN,NZ"  />

    Programmatically

    • Use setCountryPreference() method.
  • This is how it will be shown in dialog.

Clone this wiki locally