Camera2 API - Android

27,651

Solution 1

Binod,

That will only works if your platform support API level 21 - that is the one come after Android L release.

For a detailed explanation of how camera 2 API works, you may want to take a look at this article

Solution 2

you can view this example may this will help you

Android Camera2Basic Sample

This sample demonstrates the basic use of Camera2 API. Check the source code to see how you can display camera preview and take pictures. Pre-requisites

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) Camera Preview Library PkmX/lcamera

Share:
27,651
Binod Singh
Author by

Binod Singh

I love coding.. HTML5, CSS3, ReactJs, AngularJs, Android,Core Java, JEE, Spring

Updated on August 26, 2020

Comments

  • Binod Singh
    Binod Singh almost 4 years

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

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

    showing error. Does any one have worked on this api.

    Have been searching for results for could not find any thing yet.

  • pierrotlefou
    pierrotlefou almost 8 years
    @JoeBlow yes, you are right. That's the official example you can rely on. Cheers!