Is it possible to use zxing embedded ContinuousCaptureActivity out of the box?

359 Views Asked by At

I have the following method in my Activity that is getting called in the OnCreate of my Activity:

public void addListenerOnCameraButton() {
    cameraButton = (Button) findViewById(R.id.btn_camera);
    cameraButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(Tracking.this, "Kamera", Toast.LENGTH_SHORT).show();
            Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(takePictureIntent, 1);
        }
    });

    scannerButton = (Button) findViewById(R.id.btn_scanner);
    scannerButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            IntentIntegrator integrator = new IntentIntegrator(Tracking.this);
            integrator.setDesiredBarcodeFormats(IntentIntegrator.ALL_CODE_TYPES);
            integrator.setBeepEnabled(false);
            integrator.initiateScan();
        }
    });

    scanContButton = (Button) findViewById(R.id.btn_scanner_cont);
    scanContButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(Tracking.this, ContinuousCaptureActivity.class);
            startActivity(intent);
        }
    });
}

The first two .setOnClickListener are not relevant. The third one is. I want to click on my button and have it start the continuous scanning activity.

I was under the assumption that this would work.

I have added <activity android:name="com.journeyapps.barcodescanner.ContinuousCaptureActivity"/> to my Manifest but it does not work.

I receive the error Unresolved class ContinuousCaptureActivity both in the Manifest as well as in my Activity.

Am I wrong in assuming that the ContinuousCaptureActivity cannot be used and is more of an example that someone needs to rebuild himself?

Edit: For reference, I used zxing-embedded by journeyapps which can be found here: https://github.com/journeyapps/zxing-android-embedded/blob/master/sample/src/main/java/example/zxing/ContinuousCaptureActivity.java

I implemented the regular CaptureActivity just like this in my Manifest:

<activity
        android:name="com.journeyapps.barcodescanner.CaptureActivity"
        android:screenOrientation="portrait"
        tools:replace="screenOrientation" />
0

There are 0 best solutions below