i have an activity that holds Two Fragments, i want to run ZXING scanner on one of the fragments,
currently i do this on another activity like this >
new IntentIntegrator(this).initiateScan(); // opens up Scan intent > ZXING
how do i do that line but to open up the scan on a fragment ?
Also i get the ZXING results on a reciever like this >
//results when activity enters a callback sent out to another activity
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
how will i get them on my Fragment that i'm going to run Zxing on ?
THNX
If you really need to open it in a support fragment you can use:
IntentIntegrator.forSupportFragment(MyFragment.this).initiateScan();
In your Fragment:
public void onActivityResult(int requestCode, int resultCode, Intent data) {
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
String barcode = result.getContents();
}
Try it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With