orrinLife360/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.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.orrinLife360:country-picker-android:1.1.5'
	}
	dependencies {
		implementation("com.github.orrinLife360:country-picker-android:1.1.5")
	}
	<dependency>
	    <groupId>com.github.orrinLife360</groupId>
	    <artifactId>country-picker-android</artifactId>
	    <version>1.1.5</version>
	</dependency>

                            
    libraryDependencies += "com.github.orrinLife360" % "country-picker-android" % "1.1.5"
        
        

                            
    :dependencies [[com.github.orrinLife360/country-picker-android "1.1.5"]]
        
        

Readme


Download

Country Picker for Android

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

<img src="https://raw.githubusercontent.com/mukeshsolanki/country-picker-android/master/Screenshot_20160506-152951.png" width="480" height="800" />

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