Camera2 API - Android

I am trying to use the new camera api provided by android like camera2. But

CameraManager manager = (CameraManager) getActivity().getSystemService(Context.CAMERA_SERVICE);

      

shows an error. Has anyone worked on this api.

You searched for results for haven't found yet.

+3


source to share


3 answers


Binod,

This will only work if your platform supports API level 21 - this is the one that comes after the release of Android L.



A detailed explanation of how the Camera 2 API works, you might need to take a look at this article

+7


source


you can view this example, maybe it will help you

Camera for Android2Basic

This example demonstrates basic usage of the Camera2 API. Check out the source code to see how you can display the camera preview and take pictures. Prerequisites



Android SDK v21
Android Build Tools v21.1.1
Android Support Repository

      

https://github.com/googlesamples/android-Camera2Basic

Please check this Github Repo for Android L (API 21) for viewing PkmX / lcamera camera photos

+2


source


You need to make 2 classes for API 21 and below, in a more general use of the generic Camera object, and in API 21+ you can use Camera2 API

0


source







All Articles