开发者

ZXing Android Generate 1D barcode

开发者 https://www.devze.com 2023-03-13 17:31 出处:网络
I\'ve gone through the examples here regarding encoding barcode: http://code.google.com/p/zxing/source/browse/trunk/androidtest/src/com/google/zxing/client/androidtest/ZXingTestActivity.java开发者_S

I've gone through the examples here regarding encoding barcode:

http://code.google.com/p/zxing/source/browse/trunk/androidtest/src/com/google/zxing/client/androidtest/ZXingTestActivity.java

开发者_StackOverflow社区

But all it generates are QR. I'm looking for 1D barcode generation / encoding. What's the right encode type?

Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.setPackage("com.google.zxing.client.android");
intent.putExtra("ENCODE_TYPE", "???");

Barcode Scanner doesn't like ENCODE_TYPE = CODE_39 nor CODE_93. Any ideas?


You need the javadoc for Intents. You need ENCODE_FORMAT, not ENCODE_TYPE.


To encode/generate 1D barcode

Intent intent = new Intent("com.google.zxing.client.android.ENCODE");

intent.putExtra("ENCODE_FORMAT", "UPC_A");
intent.putExtra("ENCODE_DATA", "12345678901");

startActivity(intent);

The key here is ENCODE_FORMAT & the 1D barcode format in this case UPC_A & the data (for UPC code it has to be 11/12 digits) to encode

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消