My application purpose just simply captures a ISBN number then converts ISBN to a string. I know about the zxing project, however after skimming their code and research, I couldn't find the way to use their code without using Intent.

Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "ISBN");
startActivityForResult(intent, 0);

How can I avoid this step to make my application standalone from Barcode Scanner application ?

有帮助吗?

解决方案

Your problem seem to be the dependency on Zxing Barcode Scanner being present on users devices. As Gene mentions in his comment Zxing provides a "IntentIntegrator" library for this use case. It's a small Java library that you bundle with your app and handles the case where Zxing is not installed on the phone for you, amongst other things.

It is described at http://code.google.com/p/zxing/wiki/ScanningViaIntent. See also http://code.google.com/p/zxing/source/browse/trunk#trunk%2Fandroid-integration%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fintegration%2Fandroid for details (source for this library).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top