質問

I am having trouble importing the zbar library properly.

I am following this guide:

https://github.com/DushyanthMaguluru/ZBarScanner

The guide says:

Download this project and add it as a library project to your existing Android app

I downloaded this project and created a library from ZbarScannerLibary folder. I then set in the properties of my project this liabry to be used.

I then continued the guide, when I started to code the main activity I received errors that variables and imports cannot be resolved.

enter image description here

What am I doing wrong and how can I get the imports to be resolved ?

役に立ちましたか?

解決

just create a variable in your Activity:

public static final int ZBAR_SCANNER_REQUEST = 0;
public static final int ZBAR_OR_SCANNER_REQUEST = 1;

//etc

These are just used for handling activity result. In the short run, you can also comment out the onActivityResult method to test the barcode is working. You then open the barcode with:

startActivity(intent);

Finally, be sure to read up on startActivityForResult, since it is a very important topic when developing a multi-activity app.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top