I want to create a spinner for selecting a country and getting its country code.
I already found this item list:
in gradle :
// country picker
implementation 'com.hbb20:ccp:1.7.1'
in XML
in Activity :
CountryCodePicker ccp;
ccp = findViewById(R.id.ccp);
public void onCountryPickerClick(View view) {
ccp.setOnCountryChangeListener(new CountryCodePicker.OnCountryChangeListener() {
@Override
public void onCountrySelected() {
//Alert.showMessage(RegistrationActivity.this, ccp.getSelectedCountryCodeWithPlus());
selected_country_code = ccp.getSelectedCountryCodeWithPlus();
}
});
}