0

I use Zxing to scan a bar code in Android

        Button button = (Button) this.findViewById(R.id.scan);
    button.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            IntentIntegrator.initiateScan(AntennaShow.this);
        }
    });

When I touch the button,I see a popup menu,which has Zxing and other bar-code-scan apps I installed before
Question:
How can I touch the button then automatically run the Zxing because 1,I need to use the Zxing to retrieve information I scanned 2,that can be troublesome for users to choose the apt app--Zxing

IloveIniesta
  • 342
  • 4
  • 20

1 Answers1

0

The easiest thing to do is to use the IntentIntegrator class supplied with the project. See http://code.google.com/p/zxing/wiki/ScanningViaIntent

It will handle restricting to the Barcode Scanner or Barcode Scanner+ packages by default.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • I have saw the website,and I indeed used the **IntentIntegrator** method – IloveIniesta Sep 20 '12 at 08:34
  • but I just have done the thing that i can invoke the Barcode Scanner from the website.It is hard for me to automatically use the Barcode Scanner without choosing from my 3 apps about bar-code-scan – IloveIniesta Sep 20 '12 at 08:41
  • I know that I can use the `checkbox` `next time use Barcode Scanner by default`.but if i don't want to do that,how can I do? – IloveIniesta Sep 20 '12 at 08:43
  • The IntentIntegrator already restricts to just Barcode Scanner. If you use it, it really should not show other apps. It would, if those other apps had declared that *they* are also in the BS package. This is why we really discourage people from copying our app! in that case, not much you can do. – Sean Owen Sep 20 '12 at 09:30
  • oh,I see.It seems that the other 2 apps are using the core of your app.Feel honor to talk with the author.Best wishes! – IloveIniesta Sep 20 '12 at 10:37
  • Feel free to ask those authors to stop intercepting calls meant for Barcode Scanner. It's unethical even. – Sean Owen Sep 20 '12 at 13:18