Example usage for android.hardware Camera toString

List of usage examples for android.hardware Camera toString

Introduction

In this page you can find the example usage for android.hardware Camera toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:Main.java

/**
 * Return camera instance//from ww w. j  a v a  2s  .c  o m
 */
public static Camera getCameraInstance(int displayOrientation) {
    Camera cam = null;
    try {
        cam = Camera.open();

        // More efficient way to find available cameras. Nexus 7 needs this.
        if (cam == null) {
            int availableCameras = Camera.getNumberOfCameras();
            for (int i = 0; i < availableCameras; i++) {
                cam = Camera.open(i);
                if (cam != null)
                    break;
            }
        }

        cam.setDisplayOrientation(displayOrientation);
        Log.d(TAG, "Getting Camera: " + cam.toString());
    } catch (Exception e) {
        Log.e(TAG, "Camera is not available (in use or does not exist)");
        Log.e(TAG, e.toString());
    }
    return cam;
}