Search code examples
androidtabscameraqr-codebarcode-scanner

Screen blackout when camera launched


I am doing a qr code scanning when a tab item is clicked in my application. But onclick of the tab, screen blacks out for 3 secs and then the scanning camera starts. Is there a way to avoid this blackout or any related work arounds?

    intent = new Intent().setClass(this,CaptureActivity.class);
    intent.setPackage("com.google.zxing.client.android");
    intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
    setupTab(getResources().getString(R.string.icon_scan),R.drawable.scan,    0,intent);

This is the code for tab setup where Capture activity contains the code for scanning and decoding.


Solution

  • You are doing everything right, I believe. The camera driver always takes a second or so to start up, which is the delay in starting the scanning activity. 3 seconds is a long time though -- sounds like a device deficiency.