enum ErrorCorrectionLevel : Enum<ErrorCorrectionLevel>

The level of Error Correction to apply to the QR Code image. The Higher the Error Correction, the lower quality print the QRCode can be (think of "wow, even with the paper a bit crumpled, it still read the QR Code!" - that is likely a Q or H error correction).

The trade-off is the amount of data you can encode. The higher the error correction level, the less amount of data you’ll be able to encode.

Please consult Kazuhiko’s Online Demo where at the time of writing a handy table showed how many bytes can be encoded given a data type (QRCodeDataType) and Error Correction Level.

This library automatically tries to fit ~2048 bytes into the QR Code regardless of error correction level. That is the reason and meaning of maxTypeNum.

Rewritten in Kotlin from the original (GitHub)


Rafael Lins - g0dkar

Kazuhiko Arase - kazuhikoarase



value Value associated with this error correction level
maxTypeNum Maximum type value which can fit 2048 bytes. Used to automatically calculate the type value.


L [common]
M [common]
Q [common]
H [common]


Name Summary
entries [common]
val entries: EnumEntries<ErrorCorrectionLevel>
Returns a representation of an immutable list of all enum entries, in the order they’re declared.
maxTypeNum [common]
val maxTypeNum: Int
name [common]
val name: String
ordinal [common]
val ordinal: Int
value [common]
val value: Int


Name Summary
valueOf [common]
fun valueOf(value: String): ErrorCorrectionLevel
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
values [common]
fun values(): Array<ErrorCorrectionLevel>
Returns an array containing the constants of this enum type, in the order they’re declared.