Questions tagged [android-camera]

The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications.

The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications.

Official Android Camera documentation

To access the device camera, you must declare the CAMERA permission in your Android Manifest. Also be sure to include the manifest element to declare camera features used by your application. For example, if you use the camera and auto-focus feature, your Manifest should include the following:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />

The Android framework supports capturing images and video through the Camera API or camera Intent.

  • Camera This class is the primary API for controlling device cameras. This class is used to take pictures or videos when you are building a camera application.
  • SurfaceView This class is used to present a live camera preview to the user.
  • MediaRecorder This class is used to record video from the camera.
  • Intent An intent action type of MediaStore.ACTION_IMAGE_CAPTURE or MediaStore.ACTION_VIDEO_CAPTURE can be used to capture images or videos without directly using the Camera object.

The Camera class has been deprecated. It is recommend using the newer class camera2, which works on Android 5.0 (API level 21) or greater.

You can read more about camera2 on Android Official blog. For questions specifically related to camera2, use .

6513 questions
2
votes
2 answers

Camera crashes on second run.(Due to VM out of memory error)

Hi I am using this piece of code for camera in my activity. public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == TAKE_PICTURE_WITH_CAMERA) { …
Andro Selva
  • 53,910
  • 52
  • 193
  • 240
2
votes
2 answers

Running python script on android studio using Chaquopy can't open Camera

My python script uses camera to detect fingers and runs successfully on PyCharm but when trying to run it on android studio using chaquopy it gives error camera is not defined. I am new with chaquopy and cant find similar problems with other people…
2
votes
2 answers

Android 10 (api 29) how to enable HDR and Nigh Mode

I'm building a camera up designed to work exclusively on Pixel 3 XL. I'm using camera2 API and would like to take a picture using front facing camera with HDR and/or Night Mode enabled. This is a code snipped where I setup my capture request: final…
Levon Shirakyan
  • 188
  • 2
  • 11
2
votes
1 answer

Reference to "method" is ambiguous

When calling Builder() I am given the error message: Reference to 'Builder' is ambiguous, both 'androidx.camera.core.impl.UseCaseConfig.Builder' and 'androidx.camera.core.impl.ImageOutputConfig.Builder' match The error is produced within the…
2
votes
1 answer

Take photo in Android app and save it into gallery

I am developing an Android app, and at some point I have to take a photo and save it to the gallery. The camera opens and takes the photo but does not save it to the gallery. Here is my code: public class CameraActivity extends AppCompatActivity { …
João Costa
  • 57
  • 1
  • 1
  • 9
2
votes
1 answer

Image captured on HTC Desire Z shows a series of vertical lines

I have an application that uses the Camera API to capture images. The implementation is contained within a CameraActivity class that is modeled after a number of examples that I have seen within this site. The application is currently running on…
BluJ IT
  • 369
  • 3
  • 12
2
votes
0 answers

i cant load camera preview in my app but all other things working fine

commenting the line "camerasource.start();" inside the try catch made preview appear,but cant do that because the face detector doesn't work.please help... my mainactivity.java is package com.example.android.drownsinessdetector; import…
Ashiq
  • 31
  • 1
2
votes
2 answers

Couldn't find meta-data for provider with authority com.scanlibrary.provider

I have imported the scanlibrary module in my app. This module has its own Manifest file with FileProvider. This is the directory structure: Below is my code to open the camera, and the Manifest files. scanlibrary code to open camera and capture…
2
votes
0 answers

When media recorder start recording video then "onPreviewFrame" method of Camera.PreviewCallback stopped working

I am writing code to record video after analyzing frame. If the frame contains a redness level above 240 then it starts recording or redness goes bellow 230 stop video recording. But the issue is that when media recorder starts recording than the…
2
votes
0 answers

React native - process the current camera image without triggering the shutter

is it possible to process the current camera image without the user triggering the shutter using react native? Thank you!
khuesmann
  • 188
  • 1
  • 12
2
votes
3 answers

How to add multiple onActivityResult() in a single activity without going to other activities?

I am using both an ImagePicker and a barcode reader in a single activity. The main problem is that both of these require onActivityResult() to display the result. As we know a single activity can only have a single onActivityResult() method in it.…
2
votes
2 answers

Android CameraX | Color detection

I'm working with the new CameraX on Android. I did a basic application (similar to the "Get Started") in which I have a camera preview and a luminosity analyzer. Every second I display my lumonisity in a TextView. Now, following the CameraX…
PepeW
  • 477
  • 1
  • 8
  • 24
2
votes
0 answers

Camera service binder died after zooming

I'm capturing a large Bitmap after zooming on TextureView and I get this error after several shot only on some devices and nothing found about this on the web : 2019-12-29 19:27:37.940 3687-26031/? E/CameraService: binderDied: Java client's binder…
nicover
  • 2,213
  • 10
  • 24
2
votes
2 answers

Stopping surface view from rotating when displaying camera preview

I have a surface view displaying a camera preview which looks good in landscape mode, but when I rotate my phone to portrait the surface view rotates and the camera preview is on its side which looks wrong. When I fix my application orientation to…
2
votes
3 answers

App crashing in background when taking photo from camera in Oneplus

I am developing an app with functionality of taking image from camera or gallery. This is working fine in all the devices but not in OnePlus. This is the code : public File dispatchTakePictureIntent(Activity activity) { File tempPhotoFile…
Parth Anjaria
  • 3,961
  • 3
  • 30
  • 62
1 2 3
99
100