how can i create qr code from 5 editTexts in android

Skip to first unread message

Cyprian Kabia

Oct 14, 2015, 3:03:31 AM10/14/15
to zxing
hi, so far am able to generate a qr code from a single editText but i want to be able to generate from more than one editText and then have the qr scanner display the info in a kinda like a list similar to the qr code generator on the zxing website when the code is scanned. Any help will be appreciated. here's my sample code:

public void onClick(View v) {

switch (v.getId()) {
EditText qrInput = (EditText) findViewById(;
String qrInputText = qrInput.getText().toString();
Log.v(LOG_TAG, qrInputText);

//Find screen size
WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
Display display = manager.getDefaultDisplay();
Point point = new Point();
int width = point.x;
int height = point.y;
int smallerDimension = width < height ? width : height;
smallerDimension = smallerDimension * 3/4;

//Encode with a QR Code image
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrInputText,
try {
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();
ImageView myImage = (ImageView) findViewById(;

} catch (WriterException e) {

Lachezar Dobrev

Oct 14, 2015, 4:12:29 AM10/14/15
to Cyprian Kabia, zxing
  QR Code encodes a single text or binary stream.
  You'll probably have to find a way to structure the data that is to be encoded in a way that would allow a reader to understand the content.
  For textual information it is common to encode multi-line text that contains a single element on every line. That is if the content is to be read by humans. For machine processing structured content is a better fit, and even providing binary representation.

  An alternative is to host the data on a Web Server accessible by the target auditory, and encode an URL to that resource.

You received this message because you are subscribed to the Google Groups "zxing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
For more options, visit

Lachezar Dobrev

Oct 15, 2015, 3:39:56 AM10/15/15
to Cyprian Kabia, zxing
  Please reply to the mailing list when on-topic.

  Concatenation of text elements is a basic Java operation. To make a string multi-line separate the lines with a new-line character ('\n')

    String line1 = "Name: " + editTextName.getText();
    String line2 = "Allergies: "  + editTextAllergies.getText();

    String combined = line1 + "\n" + line2;

​  You can use the ZXing On-line QR Code​ Generator for playground:

2015-10-14 12:24 GMT+03:00 Cyprian Kabia <>:

Thanks for the timely reply . I want to know how I can implement multi-line text that contains a single element on every line. In my Android app cause as it is , everything is on a single line and I think my users would appreciate a multi-line presentation than a single line.

Reply all
Reply to author
0 new messages