Reputation: 6569
I'm looking for some tutorial or sample how to use Zxing library within android's Fragment.
UPDATE:
Using IntentIntegratorSupportV4 can I use only scanner if it installed on device or in my own app? Because I want to use QR Scanner in my own app which has two tabs. In fist must be this scanner. How I can handle it?
Upvotes: 6
Views: 4144
Reputation: 223
Here is a tutorial on integrating it into your own app. Although this is not recommended
Upvotes: 1
Reputation: 1006674
This sample project demonstrates the use of IntentIntegrator
, and you will find a compiled JAR containing that class in the project's libs/
directory.
There are really only two steps:
Call (new IntentIntegrator(this)).initiateScan();
to bring up the scanner.
Implement onActivityResult()
and use IntentIntegrator
to help parse the results:
public void onActivityResult(int request, int result, Intent i) {
IntentResult scan=IntentIntegrator.parseActivityResult(request, result, i);
if (scan!=null) {
format.setText(scan.getFormatName());
contents.setText(scan.getContents());
}
}
Upvotes: 5