Wrapper around the android Camera class that simplifies its usage

Related tags

Utility EasyCamera
Overview

EasyCamera

Wrapper around the android Camera class that simplifies its usage (read more about the process)

Usage:

// the surface where the preview will be displayed
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
EasyCamera camera = DefaultEasyCamera.open();
CameraActions actions = camera.startPreview(surfaceView.getHolder());
PictureCallback callback = new PictureCallback() {
    public void onPictureTaken(byte[] data, CameraActions actions) {
        // 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'
You might also like...
React Native wrapper to bridge our iOS and Android SDK
React Native wrapper to bridge our iOS and Android SDK

React Native wrapper to bridge our iOS and Android SDK

Expirable Disk Lru Cache is a secure(with encryption) wrapper for [DiskLruCache](https://github.com/JakeWharton/DiskLruCache) that allows expiring of key/value pairs by specifying evictionTimeSpan. It has very simple API.

ExpirableDiskLruCache ExpirableDiskLruCache is a wrapper for DiskLruCache that allows expiring of key/value pairs by specifying evictionTimeSpan. It h

Android library which makes it  easy to handle the different obstacles while calling an API (Web Service) in Android App.
Android library which makes it easy to handle the different obstacles while calling an API (Web Service) in Android App.

API Calling Flow API Calling Flow is a Android library which can help you to simplify handling different conditions while calling an API (Web Service)

Gesture detector framework for multitouch handling on Android, based on Android's ScaleGestureDetector

Android Gesture Detectors Framework Introduction Since I was amazed Android has a ScaleGestureDetector since API level 8 but (still) no such thing as

Use Android as Rubber Ducky against another Android device
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

A util for setting status bar style on Android App.
A util for setting status bar style on Android App.

StatusBarUtil A util for setting status bar style on Android App. It can work above API 19(KitKat 4.4). 中文版点我 Sample Download StatusBarUtil-Demo Chang

Java implementation of a Disk-based LRU cache which specifically targets Android compatibility.

Disk LRU Cache A cache that uses a bounded amount of space on a filesystem. Each cache entry has a string key and a fixed number of values. Each key m

a simple cache for android and java

ASimpleCache ASimpleCache 是一个为android制定的 轻量级的 开源缓存框架。轻量到只有一个java文件(由十几个类精简而来)。 1、它可以缓存什么东西? 普通的字符串、JsonObject、JsonArray、Bitmap、Drawable、序列化的java对象,和 b

Comments
  • Black Screen

    Black Screen

    Hello! when I call startPreview on the onCreate method of an activity or a fragment, the surface becomes black (but my webcam turns on the led indicating it's on) it only works when i call startPreview on a click of a button or something that will happen on a later time.. How can I fix that?

    opened by rafaelcorreiapoli 3
  • Camera is Freezing

    Camera is Freezing

    After i open easycamera class, i get preview of the camera but camera is freezing.

    public class MakePhotoActivity extends Activity {

    SurfaceHolder previewHolder;
    SurfaceView mSurfaceView;
    private boolean previewIsRunning;
    private EasyCamera camera;
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    
        mSurfaceView = (SurfaceView) findViewById(R.id.surface);
        previewHolder = mSurfaceView.getHolder();
        previewHolder.addCallback(new SurfaceHolder.Callback() {
    
            public void surfaceChanged(SurfaceHolder holder, int format,
                    int width, int height) {
                 if (!previewIsRunning && (camera != null)) {
                     try {
                        camera.startPreview(holder);
                    } catch (IOException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                     previewIsRunning = true;
                 }
            }
    
            public void surfaceCreated(SurfaceHolder holder) {
    
                camera = DefaultEasyCamera.open(CameraInfo.CAMERA_FACING_FRONT);
    
            }
    
            public void surfaceDestroyed(SurfaceHolder holder) { 
                camera.close();
                camera = null;
    
            }
    
        });
    }
    

    }

    opened by enversalih 3
Owner
Bozhidar Bozhanov
Bozhidar Bozhanov
Allows usage of iCalendar files with the Android calendar provider

ical4android ical4android is a library for Android that brings together iCalendar and Android. It's a framework for parsing and generating iCalendar r

bitfire web engineering 9 Dec 29, 2022
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

Levi Bostian 56 Oct 3, 2022
ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions

ModernStorage ModernStorage is a group of libraries that provide an abstraction layer over storage on Android to simplify its interactions by apps dev

Google 1.1k Dec 30, 2022
A logger with a small, extensible API which provides utility on top of Android's normal Log class.

This is a logger with a small, extensible API which provides utility on top of Android's normal Log class. I copy this class into all the little apps

Jake Wharton 9.8k Dec 30, 2022
Kotlin matrix class which supports determinant, inverse matrix, matmul, etc.

Kotrix is a set of classes that helps people dealing with linear algebra in Kotlin.

Kanguk Lee 5 Dec 8, 2022
BinGait is a tool to disassemble and view java class files, developed by BinClub.

BinGait Tool to diassemble java class files created by x4e. Usage To run BinGait, run java -jar target/bingait-shadow.jar and BinGait will launch. If

null 18 Jul 7, 2022
Dagger Hilt, MVP Moxy, Retrofit, Kotlin coroutine, Sealed class

Dagger Hilt, MVP Moxy, Retrofit, Kotlin coroutine, Sealed class

Dostonjon 1 Nov 2, 2021
Android Shared preference wrapper than encrypts the values of Shared Preferences. It's not bullet proof security but rather a quick win for incrementally making your android app more secure.

Secure-preferences - Deprecated Please use EncryptedSharedPreferences from androidx.security in preferenced to secure-preference. (There are no active

Scott Alexander-Bown 1.5k Dec 24, 2022
Very easy to use wrapper library for Android SharePreferences

Treasure English document Treasure是一个Android平台上基于SharePreferences的偏好存储库,只需要定义接口,无需编写实现,默认支持Serializable和Parcelable。运行时0反射,不仅使用方便而且性能和原生写法几乎无差别。 使用方法 1

星一 507 Nov 12, 2022
🪁 Android Resources Wrapper Library

Kite Android Resource Wrapper Library. TLDR Fed up with typing ContextCompat, resources and context all over your apps to access your resources? Say n

Andrea Cioccarelli 132 Dec 9, 2022