Application.getApplication().invokeLater(new Runnable() {
public void run() {
// create new local copy of the scanner screen which can be
// recreated on each event.
ScannerScreen _scannerScreen = new ScannerScreen(
capturedCallback, errorCallback, hints);
if(autoFocus) {
_scannerScreen.setAutoFocus();
}
if(macroFocus) {
_scannerScreen.setMacro();
}
if(digitalZoom != -1) {
_scannerScreen.setDigitalZoom(digitalZoom);
}
if(opticalZoom != -1) {
_scannerScreen.setOpticalZoom(opticalZoom);
}
// Push view finder screen onto the display stack
UiApplication.getUiApplication().pushScreen(_scannerScreen);
// Begin the scanning process
_scannerScreen.startScan();
}
});