Reputation: 3454
I am using the following Kotlin code to open the camera on a simple Android App and take a user profile picture. I want to only take pictures, NOT video. When I start the activity and the camera opens it also lets me record video.
val contentVvalues = ContentValues()
contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpg")
contentValues.put(MediaStore.Images.Media.TITLE, "My Picture")
contentValues.put(MediaStore.Images.Media.DESCRIPTION, "My first picture")
this.imageURI = contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues)
val cameraIntent = Intent(MediaStore.ACTION_IMAGE_CAPTURE)
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageURI)
startActivityForResult(cameraIntent, ACTION_IMAGE_CAPTURE_CODE)
I was wondering in anyone could help me with how I could go about having the image controls only?
I also notice I get the stickers and other controls. How do I remove those?
Thanks for the help!
Upvotes: 1
Views: 2817
Reputation: 1007359
When I start the activity and the camera opens it also lets me record video.
There are ~2.5 billion Android devices, spread across ~26,000 device models. There will be dozens, if not hundreds, of pre-installed camera apps across those device models that might respond to ACTION_IMAGE_CAPTURE
. There are also dozens, if not hundreds, of camera apps that the user might have installed that might respond to ACTION_IMAGE_CAPTURE
. Your code could be starting any of those hundreds of apps.
And what a camera app does is up to the developers of the camera app, not you.
I also notice I get the stickers and other controls. How do I remove those?
You don't. That is the choice of the camera app developers.
In the case of offering both still image and video capture, that's arguably a bug in that particular camera app. There is very little that you can do about that.
I was wondering in anyone could help me with how I could go about having the image controls only?
Stop using ACTION_IMAGE_CAPTURE
. Write your own camera code, probably using a library (Google's CameraX, Fotoapparat, CameraKit-Android, etc.).
Upvotes: 1