7heViking
7heViking

Reputation: 7577

Using android.hardware.camera2

For some reason Android Studio doesn't find the new camera library: android.hardware.camera2

Do you have any suggestions? The code looks like this:

enter image description here

Upvotes: 3

Views: 4552

Answers (3)

josua josh
josua josh

Reputation: 88

import android.hardware.camera2.*;

is different from

Camera camera; //this one uses android.hardware.Camera.*;

see the android.hardware.Camera and android.hardware.camera2 documentation.

This is some example classes available on camera2 to be used on the new API 21+

import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCaptureSession;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraMetadata;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.TotalCaptureResult;
import android.hardware.camera2.params.StreamConfigurationMap;

Upvotes: 0

Harendra Kr. Jadon
Harendra Kr. Jadon

Reputation: 179

There is no Camera class in new package for Camera i.e. android.hardware.camera2. To use Camera class use the deprecated package android.hardware.Camera.

Upvotes: 0

N J
N J

Reputation: 27515

This is because you camera2 is package name not class name

see this link

You must call import android.hardware.camera2.*; to import all calss from camera2 Api

Upvotes: 7

Related Questions