CountrySpecification

  • CountrySpecification is a Parcelable class used to represent a country and restrict shareable addresses.

  • It includes a CREATOR field for creating instances from a Parcel.

  • A CountrySpecification can be constructed using an ISO 3166-2 formatted country code.

  • The getCountryCode method returns the 2-letter ISO 3166-2 country code.

  • The class includes a writeToParcel method for writing the object's data to a Parcel.

public class CountrySpecification extends AbstractSafeParcelable
implements Parcelable

Parcelable representing a country. Used for restricting which addresses a user can choose to share.

Inherited Constant Summary

Field Summary

public static final Creator<CountrySpecification> CREATOR

Public Constructor Summary

CountrySpecification(String countryCode)
Constructs a country specification based on a country code.

Public Method Summary

String
void
writeToParcel(Parcel dest, int flags)

Inherited Method Summary

Fields

public static final Creator<CountrySpecification> CREATOR

Public Constructors

public CountrySpecification (String countryCode)

Constructs a country specification based on a country code.

Country code should follow the ISO 3166-2 format (ex: "US", "CA", "JP").

Parameters
countryCode an ISO 3166-2 formatted country code

Public Methods

public String getCountryCode ()

Returns
  • the 2-letter ISO 3166-2 country code (ex: "US" or "CA").

public void writeToParcel (Parcel dest, int flags)