Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
0 answers
80 views

How can I automate video recording duration (and frequency) in Kotlin? [UPDATE Nov 22 -2024] Now permissions

I have been working on an app used for video recording of sparring rounds (in boxing). On a more fundamental basis, it should be a loop that records automatically for as long (in minutes) and as many ...
FranciscoRincon's user avatar
1 vote
1 answer
62 views

identify Macro Camera in android smartphone using kotlin/java

I am trying to programmatically check whether the Android Smartphone has the macro camera or not. Tried CameraManager and through that found the different characteristics of the camera. Than found the ...
Fahad's user avatar
  • 23
1 vote
0 answers
110 views

Flutter MethodChannel: How to open the full featured camera

I opted to use Flutter MethodChannel to access the phone camera since the Flutter camera plugin seems to be limited for our use case. Consider the code snippets below: Flutter/Dart import 'package:...
Kennedy Mwenda's user avatar
0 votes
0 answers
110 views

Android - How to display captured image from CameraX full size in ImageView?

I am using Kotlin CameraX, I have successfully implemented PreviewView with ratio 16:9 I successfully Captured Image using ImageCapture.takePicture(...) imageCapture.takePicture(executor, object : ...
Taufik Fadlurahman Fajari's user avatar
0 votes
0 answers
23 views

Returning to App in Portrait Mode from Third Party API ACTION_IMAGE_CAPTURE - Kotlin

I have an app which operates strictly in portrait mode. I call the camera app via ACTION_IMAGE_CAPTURE. The user is able to take pictures in landscape mode and if they click the "OK" button ...
Whitt's user avatar
  • 57
0 votes
2 answers
307 views

How to implement pinch to zoom and camera preview kotlin

I have a camera I'm trying to create in my app that allows users to pinch the preview screen when using the camera. I've been trying to implement pinch to zoom in my camera, but I am having no luck at ...
Khumo Mashapa's user avatar
0 votes
0 answers
68 views

Android - Camera2 tap to focus not working

I am working on a Camera2 library that has a auto-focusing preview, and should support "tap to focus" to focus to a specific area. I tried to follow tutorials in the internet, read Google's ...
mrousavy's user avatar
  • 1,107
0 votes
0 answers
23 views

How to Change contrast in Camera1 api PreviewCallback -Android

I am developing an Android app using Camera1 API. I want to dynamically adjust the contrast of the preview image captured by the camera. How should I do this? I learned about the PreviewCallback ...
qaz qwe's user avatar
0 votes
1 answer
243 views

Intent to open front camera not working for Android 12 and below

I am trying to open the front camera using intent. For that, I am using this extra val intent = Intent(MediaStore.ACTION_VIDEO_CAPTURE) intent.putExtra("android.intent.extras.CAMERA_FACING", ...
Roop Kishore's user avatar
1 vote
1 answer
301 views

Application gets killed during camera/file intent Xiaomi Android API 29

I'm having a little bit of an headache with several applications in Kotlin - Compose; I'll go straight to the point: Context The issue is consistently happening (9 times out of 10) with Xiaomi devices ...
x-devel's user avatar
  • 153
0 votes
2 answers
359 views

Why camera does not work versions that lower than api 33?

I have camera in my project to take video with voice and save this in device folder. I am using Dexter library for permission check. Camera open on device with higher than api 32. but lower api 33 it'...
Ahmet Yılmaz's user avatar
0 votes
1 answer
2k views

How to crop an image from camera and gallery directly in Jetpack Compose

I would like to implement a functionality where the user can choose between the camera and gallery options when they click on a button. Once the user selects an image from either option, I want to ...
propeace's user avatar
0 votes
1 answer
268 views

Android Studio , Camera Manager turnOnTorchWithStrengthLevel throw exception. How to resolve?

I'm using api 34 for my android phone galaxy. everything was working fine until I tried to use the Camera Manager turnOnTorchWithStrengthLevel. The code: package com.example.myflashlight import ...
Daniel Lip's user avatar
  • 11.3k
0 votes
1 answer
383 views

getting data null on registerForActivityResult

So everything is worling good camera is opening and also permission dialog is opening if there i no permission, but the image is not getting displayed in the image view. because i am getting null on ...
Jayanta Sarkar's user avatar
0 votes
1 answer
95 views

MediaRecorder stop() function fails

class MainActivity : AppCompatActivity() { // Thread handlers for Camera2 API threads lateinit var handler: Handler lateinit var handlerThread: HandlerThread lateinit var ...
Derek Wu's user avatar
0 votes
1 answer
1k views

Request camera permission if user does not allow in kotlin jetpack compose?

I want to enable the user to take a photo using the camera, actually, it is something that is done everywhere and is not very difficult, but I could not do some of it here. If the user gives ...
NewPartizal's user avatar
  • 1,094
0 votes
2 answers
596 views

How can I take a photo of a specific area on the camera screen in Android using CameraX?

I want to take photo of a specific area on the camera screen I've tried to calculate and crop the photo I take I've tried some libraries but nothing I do is worked so I need your help because I'm ...
Kaljal's user avatar
  • 3
1 vote
0 answers
173 views

Convert YUV NV21 to RGB in VideoSink

Using the code bellow I manage to get NV21. So on output I get black and white image, it is possible that the chrominance (UV) data is not being handled correctly during rendering, leaving only the ...
Nikola C's user avatar
  • 352
1 vote
1 answer
67 views

One Plus Nord - MediaStore.EXTRA_DURATION_LIMIT - not working., Unable to set the time limit

MediaStore.EXTRA_DURATION_LIMIT not working val takePictureIntent = Intent(MediaStore.ACTION_VIDEO_CAPTURE) takePictureIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30) takePictureIntent.addFlags(...
Francis.X's user avatar
1 vote
2 answers
855 views

is there any way to change the default message of RequestPermission() in Android using kotlin?

I'm developping an app that requires the Camera permission to record videos. However, in the default notification message, it says "Allow my_app to take pictures and record videos?" which ...
Harmony Valley's user avatar
0 votes
1 answer
298 views

Turn on torch when camera is open

I need to turn on torch when camera is open. class FlashLight(private val context: Context) { private val cameraManager by lazy { context.getSystemService(Context.CAMERA_SERVICE) as CameraManager }...
Wafi_ck's user avatar
  • 1,348
7 votes
1 answer
4k views

ActivityResultContracts TakePicture it is always returning false as a result

I'm using Jetpack Compose, and when I call the method to take a picture with the camera, the result of ActivityResultContracts.TakePicture is always false. Sample code: @OptIn(...
Assis's user avatar
  • 73
0 votes
1 answer
543 views

How can I add timer in CameraX preview after pressing the Start video recording button?

My requirement is that I have to built a video recording app using Android JAVA in which user will save his 30 seconds of video which will be sent to the another server. User will use the video ...
Anshul's user avatar
  • 71
1 vote
0 answers
145 views

How to obtain screen aspect ratio unaugmented camera image in an ARCore application?

I'm working on an augmented reality application based on ARCore. I'd need to capture the screen to perform some extra manipulation, which wouldn't be a real time manipulation so it won't be in the ...
Csaba Toth's user avatar
  • 10.7k
1 vote
1 answer
140 views

Store full-size images using a FileProvider

I want to save an image in its full size. I use a file provider for this. I can take the picture, but I don't get any data in the onActivityResult function. The intent is null. What am I doing wrong? ...
Captai-N's user avatar
  • 1,472
-1 votes
1 answer
313 views

Running CameraX in a service in Android Studio with Kotlin

i want to create a class in Android Studio using Kotlin that runs Camera in background class MyForegroundService : Service() { override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): ...
ahmad yamani's user avatar
1 vote
1 answer
392 views

IOException: write failed: EINVAL (Invalid argument) on UVC FileOutputStream in Kotlin

I'm trying to write Android Camera stream frames to the UVC Buffer using FileOutputStream. For context: the UVC Driver is working on the device and it has a custom built kernel. I get 24 frames per ...
Filip Luchianenco's user avatar
1 vote
0 answers
67 views

Why does my Android Tablet not Report Focal length or Sensor width?

So this is something that's been blocking us for a while now. For context, we're trying to use Google's MediaPipe library on an Android tablet. However, it crashes complaining about a Null array ...
ObjectNameDisplay's user avatar
0 votes
0 answers
63 views

Recent API information on opening a camera in Android Studio (Kotlin)

This might come off as a weird post, because I don't directly want answers to how to fix this just yet. Over the past few weeks now I've been searching for good tutorials/information on opening the ...
shaunsnj's user avatar
1 vote
2 answers
1k views

How to stop camera from working when it no longer visible in the compisition?

I've got a bottomSheetScaffold, which contains a BottomSheet That BottomSheet uses device's Camera, where I use CameraX alongside with Google's MLkit for bar scanning Let's consider permission is ...
devMohaned's user avatar
0 votes
0 answers
228 views

i want to getSavedUri() of saved video file

i have made a simple camera application using cameraX api to record 10 sec video. app is working fine it records 10 sec video and save it into internal mobile storage but i want to get absolute path ...
Hassaan Zahid's user avatar
0 votes
1 answer
476 views

Looking for an easy way to capture images on an Android phone as a background service

I'm trying to create an application that automatically clicks pictures as you carry your phone around, the point is that it clicks pictures as you do your own business. This question is basically what ...
Selfish Stoic's user avatar
1 vote
1 answer
162 views

Get image from camera

I am trying to get an image from the camera on an Android device. I want to display the image in an ImageView. I have a button in a fragment that opens the camera. I use the Activity Results API to ...
Code-Apprentice's user avatar
0 votes
0 answers
197 views

How to take a photo without switching to the camera application?

I'm trying to create an Android application that when you receive a text message with a particular command performs actions such as taking a picture, sending an image or recording a sound. I made the ...
George Jung's user avatar
0 votes
0 answers
129 views

capturing image and displaying it in imageview in android

I'm trying to implement camera in my android app. I'm able to take a picture from camera but when trying to display it in imageview I'm getting some error and I tried to find the solution for it but ...
Jajatee Nandinee Sahoo's user avatar
-1 votes
1 answer
2k views

camera intent not working correctly for android 11+ (API versions 30+)

Code (rewrote it to run in MainActivity, so if anybody wants to reproduce the problem it will be easier): import android.app.Activity import android.content.Context import android.content.Intent ...
JustSightseeing's user avatar
1 vote
0 answers
763 views

Can I use ActivityResultContracts.TakePicturePreview() to open front camera at first rather then back camera

Can I use ActivityResultContracts.TakePicturePreview() to open front camera at first rather then back camera. @Composable fun PickImage(onImagePicked: (Uri) -> Unit) { var imageUri by remember ...
Kunal Kalwar's user avatar
3 votes
0 answers
430 views

How to convert Bitmap to ImageProxy in android?

It seems that androidx.camera.core.ImageProxy is an abstract class, but I can't find any public class that can easily build an instance with Bitmap or Image. Is there any?
12412316's user avatar
  • 797
1 vote
0 answers
142 views

SurfaceViewHolder.setFixedSize(width,height) not setting size to video saved in gallery

I want to set the video aspect ratio to 1:1 capturing during android media recorder. Im using holder.setFixedSize in onSurfaceChanged method override fun surfaceChanged(holder: SurfaceHolder, format: ...
Ahmad's user avatar
  • 76
0 votes
2 answers
278 views

Set view to be at bottom of camera preview?

I'd like to set the position of the TextView to always be at the bottom of the camera preview. This is not the case with my layout below. When the user changes the aspect the ratio of the camera ...
user avatar
1 vote
0 answers
98 views

I have implemented the ability for my app to take a picture. Why is the file path null when I try to save the image locally?

This is my very first simple and almost-complete Android application. My Goal I want to take a picture with the device's built-in camera, display it on the ImageButton in that same Fragment, and have ...
Chùnky's user avatar
  • 77
3 votes
1 answer
948 views

Turning on flashlight while using camera preview

I have the standard code of toggling flashlight: @RequiresApi(Build.VERSION_CODES.M) private fun flashlightOff() { val cameraManager: CameraManager = getSystemService(Context....
Abhinav Prakash's user avatar
1 vote
1 answer
3k views

Save image to internal storage using ActivityResultContracts.GetContent(). - (Kotlin/Java/Android)

I'm new to file storage. My main goal is to take a picture with the camera, store it with good quality, then display it in an ImageView. I want to avoid asking for user permission (to use camera and ...
madbeans's user avatar
  • 107
0 votes
1 answer
1k views

How to capture photo from recyclerView in Android - Kotlin language

I have simple task. In recyclerView when I click on any button I would like to start camera, take photo and then capture this photo. However I'm not able to find any solution for this. What I tried in ...
Pavel Kostal's user avatar
0 votes
3 answers
4k views

Why does my app keep crashing when launching the camera intent in a new activity?

I'm trying to launch the camera in a new activity but whenever I press the button to open the camera, my app keeps crashing. If I create a separate app to launch the camera and take a picture, it ...
Nicholas Bissessar's user avatar
0 votes
2 answers
3k views

How to resolve No Activity found to handle Intent

I am getting an error when accessing camera the error is android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.media.action.IMAGE_CAPTURE flg=0x3 clip={text/uri-...
BRDroid's user avatar
  • 4,358
1 vote
2 answers
4k views

How to increase image quality with android cameraX library?

I am creating an application which must implement its own camera. I use the cameraX library provided by google. I noticed that there is a difference between the quality of the image captured by my own ...
user avatar
0 votes
1 answer
4k views

How to Save Image from ImageView To gallery

I am trying to save a taken image from the camera activity to the gallery so i made a function for it to do the same.Though the app is running but the image is not getting saved in the gallery.Can ...
Pulkit Jain's user avatar
0 votes
0 answers
270 views

Replace a image with a rotated image in file location - android

when an image is captured on camera, I am using a ExifConverter to rotate the image correctly. I want to replace the file in the uri/path with the rotated image so this path can be sent to the ...
BRDroid's user avatar
  • 4,358
0 votes
1 answer
1k views

why a captured image bitmap from Android camera is rotated

I am using IMAGE_CAPTURE camera intent to capture and image and storing it in a file using MediaStore.EXTRA_OUTPUT. When I receive the image in onActivityResult, the bitmap is rotated. Any suggestions ...
BRDroid's user avatar
  • 4,358