Skip to content

A simple app demostrates to load country/state/city from CCS api

Notifications You must be signed in to change notification settings

piyushjohnson/CountryStateCityApp

Repository files navigation

CountryStateCityApp

A simple app demostrates to load country/state/city names

Setup

Add jitpack to project level build.gradle

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

Add CCSApi dependency to app module build.gradle

dependencies {
	        implementation 'com.github.piyushjohnson:CCS:724f99e466'
}

Usage

Creating instance of CCSApi

CCSApi api = new CCSApi(this);

Getting country names

 ccsApi.getCountries().getResult(new CCSApi.Callback() {
            @Override
            public void onResult(List<String> values) {
                
            }
});

Getting state names

String selectedCountry = "India";
 ccsApi.getStates(selectedCountry).getResult(new CCSApi.Callback() {
            @Override
            public void onResult(List<String> values) {
                
            }
});

Getting city names

String selectedState = "Rajasthan";
 ccsApi.getCities(selectedState).getResult(new CCSApi.Callback() {
            @Override
            public void onResult(List<String> values) {
                
            }
});