Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.hardware.Camera;

public class Main {
    static final int CAMERA_FACING_BACK = 0;

    public static boolean hasCamera() {
        final int cameraCount = Camera.getNumberOfCameras();
        Camera.CameraInfo info = new Camera.CameraInfo();
        for (int i = 0; i < cameraCount; i++) {
            Camera.getCameraInfo(i, info);
            if (info.facing == CAMERA_FACING_BACK) {
                return true;
            }
        }
        return false;
    }
}