3

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.

3
  • Can you share the error with us? Commented Nov 24, 2014 at 16:55
  • @Binod Did you get this resolved, or perhaps we can guide you to it now that the SDK has been out for a while now? Commented Jan 19, 2015 at 15:07
  • I went with the old camera api at that time. I will be good if you can guide so that others can get benefited. Commented Jan 20, 2015 at 5:56

3 Answers 3

7

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

Sign up to request clarification or add additional context in comments.

1 Comment

@JoeBlow yes, you are right. That's the official example you can rely on. Cheers!
2
+50

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

Comments

0

You need to make 2 classes for API 21 and lower, in lower use common Camera object, and in API 21+ you can use Camera2 API

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.