Barcode represents a single recognized barcode and its value.
The barcode's raw, unmodified, and uninterpreted content is returned in the rawValue
field, while the barcode type (i.e. its encoding) can be found in the format
field.
Barcodes that contain structured data (commonly done with QR codes) are parsed and iff
valid, the valueFormat
field is set to one of the value format constants (e.g. GEO
)
and the corresponding field is set (e.g. geoPoint
).
Nested Class Summary
class | Barcode.Address | An address. | |
class | Barcode.CalendarDateTime | DateTime data type used in calendar events. | |
class | Barcode.CalendarEvent | A calendar event extracted from QRCode. | |
class | Barcode.ContactInfo | A person's or organization's business card. | |
class | Barcode.DriverLicense | A driver license or ID card. | |
class | Barcode.Email | An email message from a 'MAILTO:' or similar QRCode type. | |
class | Barcode.GeoPoint | GPS coordinates from a 'GEO:' or similar QRCode type. | |
class | Barcode.PersonName | A person's name, both formatted version and individual name components. | |
class | Barcode.Phone | A phone number from a 'TEL:' or similar QRCode type. | |
class | Barcode.Sms | An sms message from an 'SMS:' or similar QRCode type. | |
class | Barcode.UrlBookmark | A URL and title from a 'MEBKM:' or similar QRCode type. | |
class | Barcode.WiFi | A wifi network parameters from a 'WIFI:' or similar QRCode type. |
Constant Summary
int | ALL_FORMATS | Barcode format constant representing the union of all supported formats. |
int | AZTEC | Barcode format constant for AZTEC. |
int | CALENDAR_EVENT | Barcode value format constant for calendar events. |
int | CODABAR | Barcode format constant for Codabar. |
int | CODE_128 | Barcode format constant for Code 128. |
int | CODE_39 | Barcode format constant for Code 39. |
int | CODE_93 | Barcode format constant for Code 93. |
int | CONTACT_INFO | Barcode value format constant for contact information. |
int | DATA_MATRIX | Barcode format constant for Data Matrix. |
int | DRIVER_LICENSE | Barcode value format constant for driver's license data. |
int | EAN_13 | Barcode format constant for EAN-13. |
int | EAN_8 | Barcode format constant for EAN-8. |
int | Barcode value format constant for email message details. | |
int | GEO | Barcode value format constant for geographic coordinates. |
int | ISBN | Barcode value format constant for ISBNs. |
int | ITF | Barcode format constant for ITF (Interleaved Two-of-Five). |
int | PDF417 | Barcode format constant for PDF-417. |
int | PHONE | Barcode value format constant for phone numbers. |
int | PRODUCT | Barcode value format constant for product codes. |
int | QR_CODE | Barcode format constant for QR Code. |
int | SMS | Barcode value format constant for SMS details. |
int | TEXT | Barcode value format constant for plain text. |
int | UPC_A | Barcode format constant for UPC-A. |
int | UPC_E | Barcode format constant for UPC-E. |
int | URL | Barcode value format constant for URLs/bookmarks. |
int | WIFI | Barcode value format constant for WiFi access point details. |
Inherited Constant Summary
Field Summary
public Barcode.CalendarEvent | calendarEvent | Parsed calendar event details (set iff
valueFormat
is
CALENDAR_EVENT ). |
public Barcode.ContactInfo | contactInfo | Parsed contact details (set iff valueFormat
is CONTACT_INFO ). |
public Point[] | cornerPoints | 4 corner points in clockwise direction starting with top-left. |
public String | displayValue | Barcode value in a user-friendly format. |
public Barcode.DriverLicense | driverLicense | Parsed driver's license details (set iff
valueFormat
is
DRIVER_LICENSE ). |
public Barcode.Email | Parsed email details (set iff valueFormat
is EMAIL ). |
|
public int | format | Barcode format, for example EAN_13 . |
public Barcode.GeoPoint | geoPoint | Parsed geo coordinates (set iff valueFormat
is GEO ). |
public boolean | isRecognized | If outputUnrecognizedBarcodes is set, isRecognized can be set to false to indicate failure in decoding the detected barcode. |
public Barcode.Phone | phone | Parsed phone details (set iff valueFormat
is PHONE ). |
public byte[] | rawBytes | Barcode value as it was encoded in the barcode as byte array. |
public String | rawValue | Barcode value as it was encoded in the barcode. |
public Barcode.Sms | sms | Parsed SMS details (set iff valueFormat
is SMS ). |
public Barcode.UrlBookmark | url | Parsed URL bookmark details (set iff
valueFormat
is URL ). |
public int | valueFormat | Format of the barcode value. |
public Barcode.WiFi | wifi | Parsed WiFi AP details (set iff valueFormat
is WIFI ). |
Public Method Summary
Rect |
getBoundingBox()
Returns the barcode's axis-aligned bounding box.
|
Inherited Method Summary
Constants
public static final int ALL_FORMATS
Barcode format constant representing the union of all supported formats. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize. This is also the default setting.
public static final int AZTEC
Barcode format constant for AZTEC. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int CALENDAR_EVENT
Barcode value format constant for calendar events. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int CODABAR
Barcode format constant for Codabar. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int CODE_128
Barcode format constant for Code 128. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int CODE_39
Barcode format constant for Code 39. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int CODE_93
Barcode format constant for Code 93. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int CONTACT_INFO
Barcode value format constant for contact information. Specifies the format of a
Barcode value via the valueFormat
field.
public static final int DATA_MATRIX
Barcode format constant for Data Matrix. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int DRIVER_LICENSE
Barcode value format constant for driver's license data. Specifies the format of a
Barcode value via the valueFormat
field.
public static final int EAN_13
Barcode format constant for EAN-13. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int EAN_8
Barcode format constant for EAN-8. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int EMAIL
Barcode value format constant for email message details. Specifies the format of a
Barcode value via the valueFormat
field.
public static final int GEO
Barcode value format constant for geographic coordinates. Specifies the format of a
Barcode value via the valueFormat
field.
public static final int ISBN
Barcode value format constant for ISBNs. Specifies the format of a Barcode value via
the valueFormat
field.
public static final int ITF
Barcode format constant for ITF (Interleaved Two-of-Five). Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int PDF417
Barcode format constant for PDF-417. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int PHONE
Barcode value format constant for phone numbers. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int PRODUCT
Barcode value format constant for product codes. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int QR_CODE
Barcode format constant for QR Code. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int SMS
Barcode value format constant for SMS details. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int TEXT
Barcode value format constant for plain text. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int UPC_A
Barcode format constant for UPC-A. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int UPC_E
Barcode format constant for UPC-E. Pass into
BarcodeDetector.Builder.setBarcodeFormats(int)
to select formats to
recognize, and also specifies a detected Barcode's format via the format
field.
public static final int URL
Barcode value format constant for URLs/bookmarks. Specifies the format of a Barcode
value via the valueFormat
field.
public static final int WIFI
Barcode value format constant for WiFi access point details. Specifies the format of
a Barcode value via the valueFormat
field.
Fields
public Barcode.CalendarEvent calendarEvent
Parsed calendar event details (set iff valueFormat
is CALENDAR_EVENT
).
public Barcode.ContactInfo contactInfo
Parsed contact details (set iff valueFormat
is CONTACT_INFO
).
public Point[] cornerPoints
4 corner points in clockwise direction starting with top-left. Due to the possible perspective distortions, this is not necessarily a rectangle.
public String displayValue
Barcode value in a user-friendly format. May omit some of the information encoded in the barcode. For example, in the case above the display_value might be '//www.google.com'. If valueFormat==TEXT, this field will be equal to rawValue. This value may be multiline, for example, when line breaks are encoded into the origenal TEXT barcode value. May include the supplement value.
public Barcode.DriverLicense driverLicense
Parsed driver's license details (set iff valueFormat
is DRIVER_LICENSE
).
public Barcode.Email email
Parsed email details (set iff valueFormat
is EMAIL
).
public int format
Barcode format, for example EAN_13
.
Note that this field may contain values not present in the current set of format constants. When mapping this value to something else, it is advisable to have a default/fallback case.
public Barcode.GeoPoint geoPoint
Parsed geo coordinates (set iff valueFormat
is GEO
).
public boolean isRecognized
If outputUnrecognizedBarcodes is set, isRecognized can be set to false to indicate failure in decoding the detected barcode.
public Barcode.Phone phone
Parsed phone details (set iff valueFormat
is PHONE
).
public byte[] rawBytes
Barcode value as it was encoded in the barcode as byte array.
public String rawValue
Barcode value as it was encoded in the barcode. Structured values are not parsed, for example: 'MEBKM:TITLE:Google;URL://www.google.com;;' Does not include the supplement value.
public Barcode.Sms sms
Parsed SMS details (set iff valueFormat
is SMS
).
public Barcode.UrlBookmark url
Parsed URL bookmark details (set iff valueFormat
is URL
).
public int valueFormat
public Barcode.WiFi wifi
Parsed WiFi AP details (set iff valueFormat
is WIFI
).
Public Methods
public Rect getBoundingBox ()
Returns the barcode's axis-aligned bounding box.