Debut

Additional

Language
Kotlin
Version
N/A
Created
Jan 9, 2018
Updated
Jan 22, 2018 (Retired)
Owner
Lakhwinder Singh (lakhwinderdebut)
Contributors
Debut Infotech (debutdeveloper)
lakhwinderdebut2014
2
Activity
Badge
Generate
Download
Source code

Country Picker Android

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

Getting Started

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"
  }

How To Use in Kotlin

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()
                 }
              })

How To Use in Java

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);
                }
            });