I want to Scan QR codes on button Click, problem is when I run code on my device Activity Result Intent variable always returns 0.
How do I know if the barcode reader work? I currently see yellow dots on the device's screen.
Here is my code:
private OnClickListener scanner = new OnClickListener() {
public void onClick(View v) {
IntentIntegrator.initiateScan(BarCodeScannerActivity.this);
}
};
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
if (scanResult != null) {
// handle scan result
String s = "http://www.google.com/search?q=";
s += scanResult.getContents();
Intent myIntent1 = new Intent(Intent.ACTION_VIEW, Uri.parse(s));
startActivity(myIntent1);
}
Thanks