I would prefer/advise to use Zbar instead of zxing. zxing takes time to read qr code when compared to zbar and also u may need to install their own(zxing) app - Barcode Scanner for scanning. I have tried both and I found zbar better. Download zbar source code from here. Unzip the file and import the ZBarScannerLibrary as a library project. Add this library to your android application. Also add this to your scanButton `
if (check_if_camera_is_available) {
Intent intent = new Intent(MyWallet.this, ZBarScannerActivity.class);
startActivityForResult(intent, ZBAR_SCANNER_REQUEST);
}
else
{
Toast.makeText(MyWallet.this, "Camera Unavailable", Toast.LENGTH_SHORT).show();
}`
Also declare these variables in your activity otherwise you may hit error
private static final int ZBAR_SCANNER_REQUEST = 0;
private static final int ZBAR_QR_SCANNER_REQUEST = 1;
Finally in your manifest file add this
<activity android:name="com.dm.zbar.android.scanner.ZBarScannerActivity"
android:screenOrientation="landscape"
android:label="@string/app_name" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
Hope this helps :-)