I am using ZXing via intent to scan 1D bar-codes. ZXing sends me back the type of 1D barcode that was scanned (UPC-A, Code 39, etc...) and the string that is encoded in the barcode. I would like to take the type and string and generate and image of the 1D barcode and display it in an ImageView in an activity.
I am also open to displaying the barcode in a TextView using a font similar to "Free 3 of 9", but I cannot figure out how to do this.
I noticed that there is an activity in ZXing called EncodeActivity that can perform what I need, but only for QR codes.
Any help would be appreciated.
Thanks.
Using ZXing IntentIntegrator
and IntentResult
classes!
String data = "123456789";
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra("ENCODE_FORMAT", "CODE_128");
intent.putExtra("ENCODE_DATA", data);
startActivity(intent);
It only works if you have the Barcode reader installed on your Android
If you need help, ask me!
Display Barcode using Google barcode reader
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.putExtra("ENCODE_TYPE", "TEXT_TYPE");
intent.putExtra("ENCODE_DATA",scan_code_main); // content part
intent.putExtra("ENCODE_FORMAT",scan_code_2); // format part
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With