This library is not maintained anymore. No more development will be done.
This country picker is a simple dialog window presenting a list of countries translated in the user's phone language. It return an object containing the flag resource, the iso and dialing code of the selected country. See the example to see more detail.
You can install this dependency by downloading the source code or directly via gradle with the help of jitpack
To show CountryPicker as a dialog:
CountryPickerDialog countryPicker =
new CountryPickerDialog(mContext, new CountryPickerCallbacks() {
@Override
public void onCountrySelected(Country country, int flagResId) {
// TODO handle callback
}
});
countryPicker.show();
If you want to retrieve a flag res outside of the country picker dialog
use Utils.getMipmapResId(Context context, String drawableName)
where
the drawable have to be formatted as follow: countryIsoCodeInLowerCase_flag
.
For example:
Utils.getMipmapResId(mContext, "fr_flag")