1.集成Zxing.bar
2.复制代码到项目中
3.修改 MipacActivityCapture.java 的扫描结果方法 handleDecode()
/**
* 处理扫描结果,实现活动页面跳转
* @param result
* @param barcode
*/
public void handleDecode(Result result, Bitmap barcode) {
inactivityTimer.onActivity();
playBeepSoundAndVibrate();
String resultString = result.getText();
if (resultString.equals("")) {
Toast.makeText(MipcaActivityCapture.this, "Scan failed!", Toast.LENGTH_SHORT).show();
}else {
Intent resultIntent = new Intent(MipcaActivityCapture.this,NewsMainActivity.class);
Bundle bundle = new Bundle(); bundle.putString("result", resultString);
bundle.putParcelable("bitmap", barcode); resultIntent.putExtras(bundle);
//this.setResult(RESULT_OK, resultIntent);
startActivity(resultIntent);
}
MipcaActivityCapture.this.finish();
}