如何创建吧code扫描仪(安卓)?扫描仪、code

2023-09-04 12:43:13 作者:笑看装逼狗

谁能告诉我,如果创建(Android版)吧code扫描仪的应用程序是困难的?是OpenCV库好的开始?我在哪里可以找到算法,它清楚地解释了如何阅读吧codeS?我将AP preciate关于此主题的所有材料好!

Can someone tell me if creating barcode scanner app (for Android) is difficult? Is OpenCV library good start? Where can I find algorithm which clearly explains how to read barcodes? I will appreciate all good materials about this topic!

在此先感谢!

推荐答案

该ZXing项目提供了一个独立的酒吧code阅读器的应用程序 - 通过Android的意图机制 - 可以通过谁希望集成吧$ C其他应用程序被称为$ C扫描。

The ZXing project provides a standalone barcode reader application which — via Android's intent mechanism — can be called by other applications who wish to integrate barcode scanning.

要做到这一点最简单的方法是从你的应用程序中调用ZXing扫描意图,是这样的:

The easiest way to do this is to call the ZXing SCAN Intent from your application, like this:

public Button.OnClickListener mScan = new Button.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, 0);
    }
};

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }
}

pressing挂MSCAN按钮将直接启动进入ZXing吧code扫描仪屏幕(或崩溃,如果没有安装ZXing)。一旦吧code已被确认,您将收到的结果在你的活动,在这里的内容变量。

Pressing the button linked to mScan would launch directly into the ZXing barcode scanner screen (or crash if ZXing isn't installed). Once a barcode has been recognised, you'll receive the result in your Activity, here in the contents variable.

要避免崩溃,并简化了你的东西,ZXing有无provided一个实用工具类 你可以将集成到应用程序,使ZXing流畅,通过将用户重定向到Android Market的安装,如果他们没有它已经安装了。

To avoid the crashing and simplify things for you, ZXing have provided a utility class which you could integrate into your application to make the installation of ZXing smoother, by redirecting the user to the Android Market if they don't have it installed already.

最后,如果你想直接集成吧code扫描到您的应用程序,而依靠其安装在单独的ZXing应用程序,以及那么它是一个开源项目,你可以这样做! :)

Finally, if you want to integrate barcode scanning directly into your application without relying on having the separate ZXing application installed, well then it's an open source project and you can do so! :)

 
精彩推荐
图片推荐