Wrapper around the android Camera class that simplifies its usage (read more about the process)
Usage:
// the surface where the preview will be displayedSurfaceViewsurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
EasyCameracamera = DefaultEasyCamera.open();
CameraActionsactions = camera.startPreview(surfaceView.getHolder());
PictureCallbackcallback = newPictureCallback() {
publicvoidonPictureTaken(byte[] data, CameraActionsactions) {
// store picture
}
};
actions.takePicture(Callbacks.create().withJpegCallback(callback));By default, preview stops when a picture is taken. If you want to restart preview, specify .withRestartPreviewAfterCallbacks(true) on the Callbacks object
If you need the android.hardware.Camera object, get it via camera.getRawCamera()
How to import in maven:
<dependency>
<groupId>net.bozho.easycamera</groupId>
<artifactId>easycamera</artifactId>
<version>0.0.1</version>
<type>aar</type>
</dependency>How to import in gradle:
compile 'net.bozho.easycamera:easycamera:0.0.1:aar@aar'