-1

it may look like duplicate question but there is no code available to access camera or flashlight. whatever code available is old camera(android.hardware.Camera) class which is deprecated now.there is no new code for accessing the new camera class(android.hardware.camera2).so if anyone can help,it would be of great help for me.

Saurav
  • 15
  • 7
  • http://stackoverflow.com/q/27420594/115145 – CommonsWare Apr 01 '17 at 20:02
  • Possible duplicate of [Android 5, camera2 use only flash](http://stackoverflow.com/questions/27420594/android-5-camera2-use-only-flash) – Thiago Elias Apr 01 '17 at 21:48
  • i used " Android5, camera2 use only flash" code but there is a problem with that. in my log it shows this "java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraDevice.close()' on a null object reference". i can't understand the error. – Saurav Apr 04 '17 at 06:56

1 Answers1

0

There is a chance as you say but I think the old code will work and you are facing issues because of Android runtime permission from Marshmallow and above.

Try using runtime permission and tell if the error occurs.

Aniket Jadhav
  • 166
  • 11