app/src/main/java/com/quintessential/gypsy/DetectorService.java
/**
         * Process incoming messages
         *
         * @param msg message to handle
         */
Process incoming messages
@param msg message to handle
Process incoming messages @param msg message to handle
@Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case START:
                    Log.d(MainApplication.LOG_TAG, "starting background processing of frames");
                    try {
                        frameDetector.start();
                        cameraHelper.acquire(Camera.CameraInfo.CAMERA_FACING_FRONT);
                        cameraHelper.start(surfaceTexture); 
                    } catch (IllegalStateException e) {
                        Log.d(MainApplication.LOG_TAG, "couldn't open camera: " + e.getMessage());
                        return;
                    }
                    break;
                case STOP:
                    Log.d(MainApplication.LOG_TAG, "stopping background processing of frames");
                    cameraHelper.stop(); 
                    cameraHelper.release();
                    frameDetector.stop();
                    Log.d(MainApplication.LOG_TAG, "quitting detection thread");
                    ((HandlerThread) getLooper().getThread()).quit();
                    break;
                default:
                    break;
            }
        }
@ Override public void handleMessage ( Message msg ) { switch ( msg . what ) { case START : Log . d ( MainApplication . LOG_TAG , "starting background processing of frames" ) ; try { frameDetector . start ( ) ; cameraHelper . acquire ( Camera . CameraInfo . CAMERA_FACING_FRONT ) ; cameraHelper . start ( surfaceTexture ) ; } catch ( IllegalStateException e ) { Log . d ( MainApplication . LOG_TAG , "couldn't open camera: " + e . getMessage ( ) ) ; return ; } break ; case STOP : Log . d ( MainApplication . LOG_TAG , "stopping background processing of frames" ) ; cameraHelper . stop ( ) ; cameraHelper . release ( ) ; frameDetector . stop ( ) ; Log . d ( MainApplication . LOG_TAG , "quitting detection thread" ) ; ( ( HandlerThread ) getLooper ( ) . getThread ( ) ) . quit ( ) ; break ; default : break ; } }
Process incoming messages
 @param msg message to handle
Process incoming messages @param msg message to handle
//noinspection deprecation // initiates previewing // stops previewing