Search code examples
javaandroidmethodsresolve

barcodescanner - cannot resolve method resumeCameraPreview


I am using a barcodescanner library.

There is a sample code for a "SimpleScannerActivity":

public class SimpleScannerActivity extends Activity implements ZXingScannerView.ResultHandler {
    private ZXingScannerView mScannerView;

    @Override
    public void onCreate(Bundle state) {
        super.onCreate(state);
        mScannerView = new ZXingScannerView(this);   // Programmatically initialize the scanner view
        setContentView(mScannerView);                // Set the scanner view as the content view
    }

    @Override
    public void onResume() {
        super.onResume();
        mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results.
        mScannerView.startCamera();          // Start camera on resume
    }

    @Override
    public void onPause() {
        super.onPause();
        mScannerView.stopCamera();           // Stop camera on pause
    }

    @Override
    public void handleResult(Result rawResult) {
        // Do something with the result here
        Log.v(TAG, rawResult.getText()); // Prints scan results
        Log.v(TAG, rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode, pdf417 etc.)

        // If you would like to resume scanning, call this method below:
        mScannerView.resumeCameraPreview(this);
    }
}

I have copied that class and everything seems working. But only the method that reruns the onResume() method does not work with the following error message:

mScannerView.resumeCameraPreview(this); Cannot resolve method ‘resumeCameraPreview(com.ads.adstimer.fragment.Registration.Slides,FullScannerActivity)’

enter image description here

I really do not understand what I am doing wrong and how I can fix that since I just have copied that code...


Solution

  • Finally the solution is easy:

    change the dependency version from 1.8.3:

    compile 'me.dm7.barcodescanner:zxing:1.8.3'
    

    to 1.8.4:

    compile 'me.dm7.barcodescanner:zxing:1.8.4'