我成功地使用zxing来扫描代码,通过调用安装的条形码读取器的意图,但是当它发出哔声并表示良好的扫描时,我期望zxing活动会返回控制,所以我可以处理结果,但是它坐在那里并尝试再次扫描.我必须按后退按钮,然后返回,我可以做下一步.当我打电话给扫描仪时,有没有一些明显的标志?
任何建议感激不尽.非常感谢.
这是我的代码:
public boolean onTouchEvent(final MotionEvent event) { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); intent.putExtra("com.google.zxing.client.android.SCAN.SCAN_MODE","QR_CODE_MODE"); startActivityForResult(intent,0); return true; } public void onActivityResult(int requestCode,int resultCode,Intent intent) { super.onActivityResult(requestCode,resultCode,intent); if (requestCode == 0) { if (resultCode == RESULT_OK) { String contents = intent.getStringExtra("SCAN_RESULT"); String format = intent.getStringExtra("SCAN_RESULT_FORMAT"); // Handle successful scan String s = "http://www.google.com/search?q="; s += contents; Intent myIntent1 = new Intent(Intent.ACTION_VIEW,Uri.parse(s)); startActivity(myIntent1); } else if (resultCode == RESULT_CANCELED) { // Handle cancel } } } }@H_403_8@