Skip to content

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.

Notifications You must be signed in to change notification settings

jitenderdev/countryutility

Repository files navigation

Country Utility

Does your application needs user's country information? Do you want to have information of all countries up and running in less than 2 minutes? Do you want to pick user's ISO Code? Do you want to pick user's ISD Code? Do you want to have user's Flag of Country?

If any (or all) of these questions seem familiar, the Country Utility is the perfect library for you all.

Never waste your time again string all countries information in yoor database. It provides you with the available countries across the globe with thier basic information required while signup with your application. Customizations are also available w.r.t. your application theme. It provide custom colors, custom themes, ... No limits for customizations.

A quick overview of what's in it

  • the easiest possible integration
  • integrate in less than 2 minutes
  • compatible down to API Level 15
  • get you Database of all Countries
  • get you the Country Flag
  • get you the Country ISO Code
  • get you the Country ISD Code

Beautiful Country Utility for Android

Countryutility is a simple library that enables you to pick a country while signing up or get the details of a country i.e Name, Flad, ISO Code and ISD code.

Screenshots

Setup

1. Provide the gradle dependency

Step 1. Add the JitPack repository to your projects's(root) build.gradle file at the end of repositories:

allprojects {
  repositories {
    ...
    maven { url "https://jitpack.io" }
  }
}

Step 2. Add the dependency in your app's build.gradle file.

dependencies {
        compile 'com.github.jitenderdev:countryutility:v1.1'
}

2. Add your Country Utility

new CountryUtil(this).setTitle("Select Country").build();

You can keep the title empty the default title is 'All Countries'

new CountryUtil(this).build();

3. Get your picked country information in 'onActivityResult'method

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == Constants.KEY_RESULT_CODE) {
            try {
                mTvCountryName.setText(data.getStringExtra(Constants.KEY_COUNTRY_NAME));
                mTvCountryIsoCode.setText(data.getStringExtra(Constants.KEY_COUNTRY_ISO_CODE));
                mTvCountryDialCode.setText(data.getStringExtra(Constants.KEY_COUNTRY_ISD_CODE));
                mIvCountryFlag.setImageResource(data.getIntExtra(Constants.KEY_COUNTRY_FLAG, 0));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

Great. Your Country Utility Library is now ready to use.

Additional Setup

Customize your theme. Add below colors in your colors.xml

<color name="countryColorPrimary">#0FBA0A</color>
<color name="countryColorPrimaryDark">#41890B</color>
<color name="countryColorAccent">#0B1A89</color>

Your activity will be custimized with above color theme.

YOUTUBE DEMO

IMAGE ALT TEXT HERE

About

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.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages