-
-
Notifications
You must be signed in to change notification settings - Fork 506
Default Country
Harsh Bhakta edited this page Jan 9, 2018
·
3 revisions
- If
cpp_autoDetectCountry
is enabled, the default country will be set when CCP fails to detect country or something goes wrong. - If
ccp_autoDetectCountry
is disabled, the default country will be set automatically when the layout is prepared.
Add app:ccp_defaultNameCode="US"
(replace "US" with your default country name code) 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_defaultNameCode="US" />
- The other way of setting default country is using phone code, by
app:ccp_defaultPhoneCode="1"
. Setting default country using phone code is not recommended. There are few cases where more than one countries share the same phone code. This might set unexpected country as default.
app:ccp_defaultNameCode has higher priority than app:ccp_defaultPhoneCode.
- To set default country programmatically, use
setDefaultCountryUsingNameCode()
method. -
setDefaultCountryUsingNameCode()
orsetDefaultCountryUsingPhoneCode()
will not set default country as selected country in CCP view. To set default country as selected country in CCP view, callresetToDefaultCountry()
method.
If you do not specify default country from xml, IN +91 (India) will be the default country until you update default country programmatically.
- How to Integrate into your project
- Full Number Support
- Use as a Country Selector
- Auto detect country
- Auto detect language
- Remember last selection
- Country Preference
- Custom Mater List
- Exclude Countries
- Example phonenumber as hint
- Multi Language Support
- Default Country
- Country Selection Listener
- Dialog events listener
- CCP Theme Customization
- CCP Dialog Theme Customization
- Custom TypeFace
- Read Selected Country
- XML Properties
- Update Guide to v2
- Guide to Add New Language Support
- Guide to add New Country
- Change contry names for local project
- Handle CCP ClickListener Manually
- Custom Dialog Title/Hint/Empty Result ACK
- Flag Emoji Support (BETA)
- Change Log