/country-picker-android

A simple library that displays a beautiful list of all the countries allowing the user to pick the country he wishes and provide details like country code, iso code name and flag.

Primary LanguageJavaApache License 2.0Apache-2.0

Download

Country Picker for Android

CountryPicker is a simple library that can be show a country picker. See the example to see more detail.

How to use

Integrating the project is simple a refined all you need to do is add this to your app level gradle file

compile 'com.mukesh:countrypicker:1.1.5'

Once the project has been added to gradle the user can implement this with easy.

CountryPicker picker = CountryPicker.newInstance("Select Country");
picker.show(getSupportFragmentManager(), "COUNTRY_PICKER");
picker.setListener(new CountryPickerListener() {
    @Override
    public void onSelectCountry(String name, String code, String dialCode, int flagDrawableResID) {
        // Implement your code here
    }
});

That's it your all done.

Get user country based on sim

The following code will get the current users country details based on sim.

CountryPicker picker = CountryPicker.newInstance("Select Country");
Country country = picker.getUserCountryInfo(this);
//TODO use the country object