public final class World
extends java.lang.Object
Constructor and Description |
---|
World() |
Modifier and Type | Method and Description |
---|---|
static java.util.List<Country> |
getAllCountries()
Get an immutable list of all the countries with their flags
|
static java.util.List<Currency> |
getAllCurrencies()
Return all the currencies of the world
|
static Country |
getCountryFrom(int numericCode)
Get a country from its numeric code
|
static Country |
getCountryFrom(java.lang.String countryIdentifier)
Get a country from any of its identifiers
|
static int |
getFlagOf(int countryCode)
Get the flag of a country using the numeric code of the country
|
static int |
getFlagOf(java.lang.String countryIdentifier)
Get the flag of a country
|
static int |
getWorldFlag()
Get the image of the globe directly rather than querying World.getFlagOf("globe")
|
static void |
init(android.content.Context ctx)
Initialize the world, just as it is today with all its countries and flags
|
public static void init(android.content.Context ctx)
ctx
- The context where this object is called (getAppicationContext)
Call this once to initialize the data
public static int getFlagOf(int countryCode)
Pre-condition:
init(Context)
must have been called, otherwise you get image of globe
countryCode
- The numeric code of the countrypublic static int getFlagOf(@NonNull java.lang.String countryIdentifier)
Pre-condition:
init(Context)
must have been called, otherwise you get image of globe
countryIdentifier
- the 2 or 3 letter representation of the country
Note: If the values are correct and you still do not get the flag, create an issue and this will be resolved as soon as possible.
public static int getWorldFlag()
Pre-condition:
init(Context)
must have been called, otherwise you get image of globe
public static Country getCountryFrom(int numericCode)
Pre-condition:
init(Context)
must have been called, otherwise you get a country called Earth
numericCode
- The country's numeric codepublic static Country getCountryFrom(java.lang.String countryIdentifier)
Pre-condition:
init(Context)
must have been called, otherwise you get a country called Earth
countryIdentifier
- The country name, alpha2 or alpha3 values, case insensitivepublic static java.util.List<Country> getAllCountries()
Pre-condition:
init(Context)
must have been called, otherwise you get an empty list
public static java.util.List<Currency> getAllCurrencies()
Pre-condition:
init(Context)
must have been called, otherwise you get an empty list