Example usage for android.hardware.camera2 CameraAccessException getReason

List of usage examples for android.hardware.camera2 CameraAccessException getReason

Introduction

In this page you can find the example usage for android.hardware.camera2 CameraAccessException getReason.

Prototype

@AccessError
public final int getReason() 

Source Link

Document

The reason for the failure to access the camera.

Usage

From source file:com.example.android.hdrviewfinder.HdrViewfinderActivity.java

@Override
public String getErrorString(CameraAccessException e) {
    String errorMessage;// w  w  w  .  ja  v  a 2 s  .  c om
    switch (e.getReason()) {
    case CameraAccessException.CAMERA_DISABLED:
        errorMessage = getString(R.string.camera_disabled);
        break;
    case CameraAccessException.CAMERA_DISCONNECTED:
        errorMessage = getString(R.string.camera_disconnected);
        break;
    case CameraAccessException.CAMERA_ERROR:
        errorMessage = getString(R.string.camera_error);
        break;
    default:
        errorMessage = getString(R.string.camera_unknown, e.getReason());
        break;
    }
    return errorMessage;
}