Android 上的 zxing 项目

发布于 2024-11-10 07:26:44 字数 1874 浏览 3 评论 0原文

许多周前,我尝试在 Android 操作系统上开发一个小型项目 需要 ZXING,我遵循了这个网站和其他网站上的几个教程 示例:tuto1,以及这里的许多标签和教程tuto2tuto3 ...但我每次都失败了。我无法将 android 项目导入 eclipse IDE 来使用我的代码进行编译,“不能通过 Intent zxing APK - 和我的程序,如下例所示:

private Button.OnClickListener btScanListener = 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");


        try {
          startActivityForResult(intent, REQUEST_SCAN);
       } catch (ActivityNotFoundException e) {
         Toast.makeText(Main.this, "Barcode Scanner not intaled ", 2000).show();
       }
    }
};



public void onActivityResult(int reqCode, int resCode, Intent intent) {
    if (REQUEST_SCAN == reqCode) {
        if (RESULT_OK == resCode) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            Toast.makeText(this, "Succès : " + contents, 2000).show();
        } else if (RESULT_CANCELED == resCode) {
            Toast.makeText(this, "Scan annulé", 2000).show();
        }
    }
}`

”。 我感到失望、沮丧和悲伤。 导入项目后仍然有错误。 我尝试了1.5和1.6 zxing版本 我尝试导入项目c:\ZXing-1.6\android,并用c:\ZXing-1.6\zxing-1.6\android导入另一个新项目,我签出了SVN:ttp://zxing.googlecode.com/svn /trunk/zxing-read-only 用 tortoiseSVN 重现同样的工作,但不幸的是没有结果! 我真的厌倦了自己... 请帮我解决这个问题。我如何导入项目并在我自己的项目中正确编译它?

1 - 我使用 Windows 7 64 位 Home Premium

2 - 面向 Java EE Web 开发人员的 Eclipse IDE。版本:Helios Service Release 2 内部版本号:20110218-0911

运行此程序的有效且可靠的方法是什么,否则是否有视频或指南详细信息或 以前已经做过的人 如果有人能帮助我,我将非常感激

Many weeks ago,I tried to work on a mini project on Android OS
requires ZXING, I followed several tutorials on this web site and on other
Example: tuto1, and many tags and tutorials here tuto2, tuto3 ... But I failed each time. I can't import the android project into eclipse IDE to compile it with my code "not via Intent zxing APK-and my program like this example :

private Button.OnClickListener btScanListener = 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");


        try {
          startActivityForResult(intent, REQUEST_SCAN);
       } catch (ActivityNotFoundException e) {
         Toast.makeText(Main.this, "Barcode Scanner not intaled ", 2000).show();
       }
    }
};



public void onActivityResult(int reqCode, int resCode, Intent intent) {
    if (REQUEST_SCAN == reqCode) {
        if (RESULT_OK == resCode) {
            String contents = intent.getStringExtra("SCAN_RESULT");
            Toast.makeText(this, "Succès : " + contents, 2000).show();
        } else if (RESULT_CANCELED == resCode) {
            Toast.makeText(this, "Scan annulé", 2000).show();
        }
    }
}`

".
I feel disappointed, frustrated and sad.
I still have errors after importing the project.
I tried both versions 1.5 and 1.6 zxing
I tried to import the project c: \ ZXing-1.6 \ android, and an other new project with c: \ ZXing-1.6 \ zxing-1.6 \ android,I cheked out SVN: ttp: / / zxing.googlecode.com / svn / trunk / zxing-read-only with tortoiseSVN and reproduce the same work, but unfortunately without results!
I really fed up with myself ...
Please help me to solve this problem.how can I import the project and compile it correctly in my own project?

1 - I use Windows 7 64-bit Home Premium

2 - Eclipse IDE for Java EE Web Developers. Version: Helios Service Release 2 Build id: 20110218-0911

What is the effective and sure method to run this, otherwise if there is a video or a guide details or
someone who already done it previously
I would really appreciate it if someone would help me out

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

同尘 2024-11-17 07:26:44

Zxing 是一个非常好的项目,不幸的是集成它有时会很痛苦。我按照以下步骤操作。如果没有请参考博客

  • 从 zxing.org 查看 zxing 源
  • 在 eclipse 上创建一个 Android 项目
  • 删除 main.xml
  • 右键单击​​“src”目录并点击导入。按提到的顺序浏览到以下目录。当您将它们一一添加以进行导入时,请确保导入向导的编辑字段中有 src 目录。并且您仅选择左侧目录树上的“com”目录。不要选择src。
  • core
  • android-integration
  • android
  • 确保你的 android sdk 版本是 9,任何更低的版本和 androidmanifest.xml 都会哭。
  • 其中一种语言的 Strings.xml 会抄袭,只需在 ' 字符前放置一个 /

要下载示例导入,这个 将让您立即开始。

Zxing is a very nice project, unfortunately integrating it can sometimes be a pain. I followed the steps below. If not refer to blog.

  • Checkout the zxing sources from zxing.org
  • Create a Android project on your eclipse
  • Delete main.xml
  • Right click on “src” directory and hit import. Browse to the following directories in the order mentioned. As you add them for import one by one, ensure that you have the src directory in the edit field of the import wizard. And that you select only the “com” directory on the left directory tree. Do not select src.
  • core
  • android-integration
  • android
  • Ensure that your android sdk version is 9, anything lesser and androidmanifest.xml will cry.
  • Strings.xml in one of the languages will crib, just put a / before the ‘ character

For a download of a sample import, this will get you started immediately.

浮华 2024-11-17 07:26:44

你还没有对你的问题说任何话。您似乎对是否通过 Intent 进行集成感到非常困惑。您在这里通过 Intent 进行集成,这是正确的方法,而不是像您这样。 http://code.google.com/p/zxing/wiki/ScanningViaIntent

You have not said anything about your problem. You also appear pretty confused about whether you are integrating via Intent. You are integrating via Intent here, and this is the right way to do it, not as you are. http://code.google.com/p/zxing/wiki/ScanningViaIntent

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文