开发者

zxing project on android

开发者 https://www.devze.com 2023-03-09 04:59 出处:网络
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

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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消