Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zxing not working with Tabs #208

Closed
flynnben123 opened this issue Aug 30, 2016 · 14 comments
Closed

Zxing not working with Tabs #208

flynnben123 opened this issue Aug 30, 2016 · 14 comments

Comments

@flynnben123
Copy link

I just have a basic continious scan activity but when i tried to implement a tabbed view with the app, the zxing barcodeview no longer worked and it just is a black box with the text on the bottom. PLEASE HELP with this problem....???

@rkistner
Copy link
Member

rkistner commented Sep 1, 2016

Are the resume() and pause() calls made when the BarcodeView is displayed / hidden?

Are there any errors showing up in the logs?

A small sample app demonstrating the issue would help.

@flynnben123
Copy link
Author

There are no errors that come up in the logs, and yes both the resume() and pause() methods are called, here is the scan activity code:

public class ScanActivity extends AppCompatActivity {

private static final String TAG = ScanActivity.class.getSimpleName();
private DecoratedBarcodeView barcodeView;

private BarcodeCallback callback = new BarcodeCallback() {
    @Override
    public void barcodeResult(BarcodeResult result) {
        if (result.getText() != null) {
            barcodeView.setStatusText(result.getText());
        }

    }

    @Override
    public void possibleResultPoints(List<ResultPoint> resultPoints) {
    }
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_scan);

    barcodeView = (DecoratedBarcodeView) findViewById(R.id.zxing_barcode_scanner);
    barcodeView.decodeContinuous(callback);
}

@Override
protected void onResume() {
    super.onResume();

    barcodeView.resume();
}

@Override
protected void onPause() {
    super.onPause();

    barcodeView.pause();
}

public void pause(View view) {
    barcodeView.pause();
}

public void resume(View view) {
    barcodeView.resume();
}

public void triggerScan(View view) {
    barcodeView.decodeSingle(callback);
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    return barcodeView.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
}}

@rkistner
Copy link
Member

@n-mam
Copy link

n-mam commented Apr 4, 2017

tabbed scanning option doesn't seem to be working.. is there anything else that needs to be done here ?

@rkistner
Copy link
Member

rkistner commented Apr 4, 2017

@n-mam What specific issue do you get?

Note that the "Tabs" example doesn't do actual scanning - it just demonstrates the camera handling.

@n-mam
Copy link

n-mam commented Apr 4, 2017

oh okay.. just like all other options, I was expecting the scan to be operational.

Thanks for the clarification

@Nonononoki
Copy link

@rkistner Sorry to bother you, but how can I enable actual scanning in the tabbed example?

@sravanthiRaju
Copy link

Hi @rkistner .I am also trying scan using tabbed example but it is not working.
Please explain how to enable scanning in fragment in particuler tab.

Thanking You.

@Nonononoki
Copy link

@sravanthiRaju I got it working.

Add this to the ScanFragment:

CaptureManager capture;

And add this code in your onCreateView()

capture = new CaptureManager(getActivity(), barcodeView);
capture.initializeFromIntent(getActivity().getIntent(), savedInstanceState);
capture.decode();

@sravanthiRaju
Copy link

@Nonononoki Thank you for your answer.
But how we can get the QR code content result.

Thanking You.

@Nonononoki
Copy link

@sravanthiRaju

Add this in your Main Activity:

new IntentIntegrator(this).setCaptureActivity(TabbedScanning.class).initiateScan();

@sravanthiRaju
Copy link

sravanthiRaju commented Aug 30, 2018

@Nonononoki Thank You,
But i want display this result value in ScanFragment above scanning screen.I do not want to go back to Main activity.

Please Help me.

@sravanthiRaju
Copy link

@Nonononoki Thank you for your replay. And solved my issue.

@natsirasrafi
Copy link

@sravanthiRaju

Add this in your Main Activity:

new IntentIntegrator(this).setCaptureActivity(TabbedScanning.class).initiateScan();

where is the location to add in mainactivity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants