Country Picker X
A helpful and customizable Country Picker for your needs.
Gradle
repositories {
maven {
url "https://jitpack.io"
}
}
compile 'com.github.ekimual:country-picker-x:1.0.0'
Sample Usage:
/* Declare */
CountryPickerDialog countryPicker;
/* Name of your Custom JSON list */
int resourceId = getResources().getIdentifier("country_avail", "raw", getApplicationContext().getPackageName());
countryPicker = new CountryPickerDialog(MainActivity.this, new CountryPickerCallbacks() {
@Override
public void onCountrySelected(Country country, int flagResId) {
/* Get Country Name: country.getCountryName(context);
*/
/* Call countryPicker.dismiss();
to prevent memory leaks */
}
/* Set to false if you want to disable Dial Code in the results and true if you want to show it
Set to zero if you don't have a custom JSON list of countries in your raw file otherwise use
resourceId for your customly available countries */
}
, false, 0);
countryPicker.show();
Sample format of JSON list of countries Arranged in format with Country Code : Dial Code
{
"ID" : "62",
"PH" : "63",
"VN" : "84"
}