Skip to content

Configuration Java

Dionysis Lorentzos edited this page Dec 17, 2017 · 7 revisions

To configure Fotoapparat instance:

Fotoapparat
    .with(context)  
    .into(cameraView)           // view which will draw the camera preview
    .previewScaleType(ScaleType.CENTER_CROP)  // we want the preview to fill the view  
    .photoSize(biggestSize())   // we want to have the biggest photo possible
    .lensPosition(back())       // we want back camera
    .focusMode(firstAvailable(  // (optional) use the first focus mode which is supported by device
            continuousFocus(),
            autoFocus(),        // in case if continuous focus is not available on device, auto focus will be used
            fixed()             // if even auto focus is not available - fixed focus mode will be used
    ))
    .flash(firstAvailable(      // (optional) similar to how it is done for focus mode, this time for flash
            autoRedEye(),
            autoFlash(),
            torch()
    ))
    .frameProcessor(myFrameProcessor)   // (optional) receives each frame from preview stream
    .logger(loggers(            // (optional) we want to log camera events in 2 places at once
            logcat(),           // ... in logcat
            fileLogger(this)    // ... and to file
    ))
    .build();
Clone this wiki locally