Saturday, 15 August 2015

android - Scan Multiple Barcodes without loosing the camera screen -



android - Scan Multiple Barcodes without loosing the camera screen -

i trying zxing library scan barcodes. working fine via intent

now create decode multiple barcodes @ 1 time without having scan each barcode individually.

any sample appreciated.this how current code looks like.

mainactivity:

public class mainactivity extends activity implements onclicklistener { public int scanner_request_code = 123; textview tvscanresults; button btnscan; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); initviews(); } private void initviews() { tvscanresults = (textview) findviewbyid(r.id.tvresults); btnscan = (button) findviewbyid(r.id.btnscan); btnscan.setonclicklistener(this); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); homecoming true; } @override public void onactivityresult(int requestcode, int resultcode, intent intent) { if (requestcode == scanner_request_code) { // handle scan intent if (resultcode == activity.result_ok) { // handle successful scan string contents = intent.getstringextra("scan_result"); string formatname = intent.getstringextra("scan_result_format"); byte[] rawbytes = intent.getbytearrayextra("scan_result_bytes"); int intentorientation = intent.getintextra("scan_result_orientation", integer.min_value); integer orientation = (intentorientation == integer.min_value) ? null : intentorientation; string errorcorrectionlevel = intent.getstringextra("scan_result_error_correction_level"); tvscanresults.settext(contents + "\n\n" + formatname); } else if (resultcode == activity.result_canceled) { // handle cancel } } else { // handle other intents } } @override public void onclick(view v) { if (v.getid() == r.id.btnscan) { // go fullscreen scan intent intent = new intent("com.google.zxing.client.android.scan"); intent.putextra("scan_mode", "scan_mode"); startactivityforresult(intent, scanner_request_code); } } }

i couldn't find way of activating mass mode, check out project:

https://code.google.com/p/android-quick-response-code/

i imported source code project , took there.

android android-intent zxing barcode-scanner

No comments:

Post a Comment