Reputation:
I'm working in QR Code generator and scanner and I encode a single string record in QR Code successfully using zxing library in android but now I want to encode multiple records like name, address, email etc How can I do that?
Here is code for encode single record in QR using zxing:
public Bitmap encodeQR(String value) throws WriterException {
BitMatrix bitMatrix;
try {
bitMatrix = new MultiFormatWriter().encode(value, BarcodeFormat.QR_CODE, 512, 512);
} catch (WriterException e) {
e.printStackTrace();
return null;
}
return new BarcodeEncoder().createBitmap(bitMatrix);
}
Upvotes: 2
Views: 1150
Reputation: 790
You can create a JSON with what ever data you need and convert it to string
and its easy to extract data from JSON when ever needed.
For example:
{
"question": "Do you smoke?",
"options": [
"Yes",
"No"
]
}
Upvotes: 2