Country Code Picker for Android in Kotlin language. It will show a bottomSheet dialog with list of countries with their names and flags, once you selected the country the callback will provide you the country object, which includes the Country name, phoneCode, flagBitmap
Add a gradle dependency
# Root Level Gradle Dependency
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
# Module Level Gradle Dependency
dependencies {
compile "com.github.debutdeveloper:countrypickerandroid:dcbbda7fda"
compile "com.android.support:design:26.1.0"
}
CountryPicker.show(supportFragmentManager, object : CountryCallBack {
override fun onCountrySelected(country: Country) {
Snackbar.make(fab, "Country : ${country.name} and Country Code : ${country.countryCode}",
Snackbar.LENGTH_LONG).show()
}
})
First add kotlin support in your project.
Add Kotlin support in Android Project
CountryPicker.INSTANCE.show(getActivity().getSupportFragmentManager(), new CountryCallBack() {
@Override
public void onCountrySelected(Country country) {
String messsage = "Country = " + country.component1() +
" code = " + country.component2();
Utils.getInstance().showSnackbar(view, messsage);
}
});
