Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.hardware.Camera;
import android.os.Build;

public class Main {
    /** A safe way to get an instance of the Camera object. */
    public static Camera getCameraInstance() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
            return Camera.open(0); // This is the line the error occurs
        } else {
            return Camera.open();
        }
    }
}