If your issue is related to observed behavior, rather than API usage, please include information about the specific device (even if the device is an emulator).
Questions tagged [android-camerax]
807 questions
5
votes
3 answers
How to match PreviewView aspect ratio to captured image using CameraX
I have a PreviewViewthat occupies the whole screen except for the toolbar.
The preview of the camera works great, but when I capture the image, the aspect ratio is complately different.
I would like to show the image to the user after it is…

baltekg
- 985
- 9
- 31
5
votes
1 answer
How to draw on PreviewView?
I have a PreviewView instance on which i want to draw a rect based on object identifies using Firebase and Image Analyser use case.
However, unlike in Text/ SurfaceView PreviewView doesn't let any Canvas to be drawn on top of it.
What's the…

Abhishek Lahiri
- 123
- 1
- 7
5
votes
1 answer
How can I share a Surface between MediaCodec encoder and CameraX
I want to get the images from CameraX (Preview Use case) and encode them as h.264 Video using MediaCodec. How can I achieve this ?
What I was trying was, to use the Surface returned from MediaCodec.createInputSurface() in Preview.Builder() by using…

aispark
- 159
- 8
5
votes
3 answers
Android-CameraX: Switch between multiple front cameras
I´m trying to write my first Android Camera App, but it always selects the zoom camera instead of the main camera. (I tested it on a Huawei P30 Pro)
And the code is based on the offical camerax sample application…

Johannes Scheibe
- 73
- 1
- 4
5
votes
1 answer
Nothing happen when I use the code “imageCapture.takePicture” of CameraX
I'm trying to explore cameraX beta version.
I'm stuck in my implementation.
imageCapture.takePicture() imageCapture is null.
// Bind the CameraProvider to the LifeCycleOwner
val cameraSelector =…

Neila Niati
- 61
- 3
5
votes
2 answers
How to set preview size on cameraX preview?
I am trying to create a preview in portrait mode and I want the preview to be as wide as the screen and wrap content vertically. However, when I do that I always get the preview size 1200x 1200 and the preview is stretched horizontally to fill the…

Amrit
- 87
- 1
- 4
- 8
5
votes
2 answers
Is it possible to zoom cameraX or Camera2 beyond the Api max zoom limit
So I'm trying to make a binoculars/Telescope kind of app but the problem is I want to zoom to the max. I have seen there are apps on the store that does that but not sure how. I have tried cameraX linearZoom method but it only works in range between…

eC Droid
- 651
- 2
- 9
- 26
5
votes
1 answer
CameraX equivalent of Camera2's CaptureRequest
I want to use ImageAnalysis with CameraX, but adjust some Camera settings such as auto-focus or auto-white balance, exposure and frame duration.
Here's an example of the settings I need and how I set them with Camera2:
…

Sharp
- 1,335
- 1
- 12
- 27
5
votes
1 answer
Bad quality of Android CameraX preview (viewfinder)
I have a problem with a preview using CameraX sample app. Quality of the preinstalled camera app's preview is better then CameraX sample's preview, but photos quality is ok. In the sample project touch to focus is implemented too, so it isn't…

Askar Syzdykov
- 399
- 3
- 15
5
votes
1 answer
How to make CameraX Preview freeze when take a photo?
I have a flow with my custom CameraX like this:
Open camera preview (live)
Click button to take a photo
Have a process when clicking that button (convert the path to bitmap, rotated the image, cropping the image automatically, save into…

R Rifa Fauzi Komara
- 1,915
- 6
- 27
- 54
5
votes
1 answer
How to get CameraControl and CameraInfo
I'm a junior Android developer.
I'm using the last version (alpha08) of CameraX.
I am trying to set up the zoom functions and in order to do so I need CameraControl.
To get CameraControl I need an instance of my Camera -> Camera.getCameraControl()…

Lena
- 511
- 1
- 4
- 19
5
votes
2 answers
Crash using CameraX library android: java.lang.ClassNotFoundException
I am making a simple camera application using new Jetpack library CameraX.
As soon as I launch the application just by adding dependencies it is crashing.
Dependencies:
implementation "androidx.camera:camera-core:1.0.0-alpha06"
implementation…

Ananth
- 2,597
- 1
- 29
- 39
5
votes
0 answers
CameraX - No supported surface combination is found for camera device - Id : null. May be attempting to bind too many use cases
I'm using CameraX in my project and now and then I can see this weird error poping up and crashing my application. This happens to some devices - not all.
I start my camera like this:
private fun startCamera() {
if (!isAdded) {
return
…

MaaAn13
- 264
- 5
- 24
- 54
5
votes
3 answers
Camera X captures images in different rotation states
Okay, I went through different posts and find out that depending on mobile manufacturers there can be a complications such as capture images get rotated, so you have to be aware of that. What I did was:
fun rotateBitmap(bitmap: Bitmap): Bitmap? {
…

MaaAn13
- 264
- 5
- 24
- 54
5
votes
5 answers
How to fix CameraX rotation support
I faced with the issue of CameraX screen rotation support.
Portrait:
Landscape:
Transformation code:
private void updateTransform() {
Log.d(TAG, "updateTransform: ");
Matrix matrix = new Matrix();
float centerX =…

Nikita Lapin
- 149
- 1
- 1
- 8