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
1 answer

How do we get the preview frame using CameraX?

I am working on a project which uses CameraX to show the camera preview on a TextureView. The code hails from this codelab. I have used the setOnPreviewOutputUpdateListener() method to update the TextureView. private fun startCamera() { val…
Shubham Panchal
  • 4,061
  • 2
  • 11
  • 36
2
votes
3 answers

Android - Error in Camera Surface

I have this code for my app, it doesn't show any errors but everytime I run it on my phone, it crashes. Anybody have idea about this? Thanks public class CameraView extends Activity implements SurfaceHolder.Callback,OnClickListener { static…
hectichavana
  • 1,436
  • 13
  • 41
  • 71
2
votes
0 answers

CameraX chooses low resolution for given aspect ratio

I want to get the best quality for square aspect ratio and setup the next preview and capture configs for CameraX. val SQUARE_ASPECT_RATIO = Rational(1, 1) val previewConfig = PreviewConfig.Builder().apply { …
2
votes
1 answer

Record video with face filter

From the last two weeks, I'm struggling with building real-time face filter application which can also record videos but sadly I'm not successful yet. Currently, I'm using ` for rendering real-time face position. I wanna record that rectangle view…
Nitin
  • 1,280
  • 1
  • 13
  • 17
2
votes
1 answer

Expo, React Native takePictureAsync does not return

I'm using expo-camera pretty much straight from the code snippet in the docs and the takePictureAsync function never returns. async takePicture () { try { let photo = await this.camera.takePictureAsync() console.log('this will…
samcorcos
  • 2,330
  • 4
  • 27
  • 40
2
votes
0 answers

Correct combination of sensor management and camera on android

I have written an android activity to act as a simple camera but when I photo is taken the activity stores the image and stores a txt file along side, which records the gps location and orientation of the phone (i.e. the accelerometer and digital…
edparso
  • 21
  • 3
2
votes
0 answers

Convert Flutter Frame Camera to android Bitmap

I'm developing a Flutter plugin for Android and iOS using the Flutter plugin camera. First I stream the frame from the plugin using this method: controller.startImageStream((CameraImage img) { runlOnFrame( bytesList:…
Raid Lafi
  • 91
  • 1
  • 12
2
votes
0 answers

Flutter camera doesn't open in real device

I'm trying to take a picture using the package image_picker: ^0.6.1 and I have the following code: if (camera) tempStore = await ImagePicker.pickImage(source: ImageSource.camera); else tempStore = await ImagePicker.pickImage(source:…
SantiSori
  • 381
  • 2
  • 15
2
votes
2 answers

Android MediaStore : Images.Media.insertImage vs ContentResolver.insert

Recently I'm working with a camera app where I need insert all the images I'm doing in the MediaStore. I saw that there is two ways for it, but after read the documentation I don't see any clear difference between both of them. Using…
Francisco Durdin Garcia
  • 12,540
  • 9
  • 53
  • 95
2
votes
0 answers

Couldn't read row from CursorWindow. Error when rotating image from gallery

Im accessing image from gallery or directly from camera in my app. Before sending it to server, I have to be sure that image is not rotated incorrectly. So I'm using function for it to get rotation from gallery or from image taken by…
martin1337
  • 2,384
  • 6
  • 38
  • 85
2
votes
1 answer

Turn flashlight on/off In QRcodeScanner React native - Alternative Solution

Turn flashlight on/off In QRcodeScanner React native I have follow the tutorial above, but still not working. It doesn't turn on the flash on pressing the touch opacity. The issue is the same as the problem send, but the solution for him not work…
lcsvcn
  • 1,184
  • 3
  • 13
  • 28
2
votes
1 answer

Need help implementing RNCamera in a react native project

I have created a react-native project using "expo init." I want to use RNCamera, but I am getting the following error. "Possible Unhandled Promise Rejection(id:0): Error: Tried to use permissions API but the host Activity doesn't implement…
Matt123
  • 393
  • 6
  • 18
2
votes
0 answers

With the Android camera2 API, is it possible to keep exposure and framerate constant, but automatically set sensitivity/gain?

I'm working with the Android NDK's camera API, and I currently have ACAMERA_CONTROL_AE_MODE turned off, so that I can set exposure time and framerate manually for motion blur related reasons. However, I'd still like to have automatic control for the…
2
votes
2 answers

Android take a picture without preview and without interaction

I'm new in android. I found previous questions, but are quite old, actually I'm using API 23 or higher. I'm interested in a way to obtaining a picture from a camera, without displaying the preview and without any touch or interaction of the user. I…
Jeek
  • 39
  • 1
  • 6
2
votes
0 answers

access denied finding property net.dns1 photo capture using camera

While opening the camera to capture the image programmatically, I'm facing below error access denied finding property net.dns1. access denied finding property net.dns2. access denied finding property net.dns3. image able to capture, while…
Kumar
  • 969
  • 2
  • 22
  • 56
1 2 3
99
100