Class QRCodeUtils

java.lang.Object
com.example.lottery.util.QRCodeUtils

public class QRCodeUtils extends Object
Utility class for QR code related operations. Provides methods to generate unique QR content strings and render them as Bitmaps.

Satisfies requirements for: US 02.01.01: Event creation with promotional QR code.

  • Constructor Details

    • QRCodeUtils

      public QRCodeUtils()
  • Method Details

    • generateUniqueQrContent

      public static String generateUniqueQrContent(String eventId)
      Generates a unique string to be used as QR code content. Combines the eventId with a random UUID to ensure global uniqueness.
      Parameters:
      eventId - The unique ID of the event to link with the QR code.
      Returns:
      A unique string combining eventId and a random UUID seed.
    • generateQRCodeBitmap

      public static android.graphics.Bitmap generateQRCodeBitmap(String content)
      Generates a QR Code Bitmap from the given content string using the ZXing library.
      Parameters:
      content - The string content to be encoded into the QR code.
      Returns:
      A 512x512 Bitmap of the generated QR code, or null if an error occurs.
    • extractEventId

      public static String extractEventId(String qrContent)
      Extracts the eventId from scanned QR content. QR content format: eventId_UUID