Example usage for android.hardware.camera2 CameraAccessException CAMERA_DISCONNECTED

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

Introduction

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

Prototype

int CAMERA_DISCONNECTED

To view the source code for android.hardware.camera2 CameraAccessException CAMERA_DISCONNECTED.

Click Source Link

Document

The camera device is removable and has been disconnected from the Android device, or the camera id used with android.hardware.camera2.CameraManager#openCamera is no longer valid, or the camera service has shut down the connection due to a higher-priority access request for the camera device.

Usage

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

@Override
public String getErrorString(CameraAccessException e) {
    String errorMessage;/*from www .  j a  va2  s.c o m*/
    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;
}