Issue
I'm creating an app in which I got one button and when clicking on it, I open the default camera app of the device using the following code:
ActivityResultLauncher<Intent> activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
if (result.getResultCode() == RESULT_OK) {
//do sth;
}
});
Intent pictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
activityResultLauncher.launch(pictureIntent);
So in this case I am using MediaStore.ACTION_IMAGE_CAPTURE passed to the Intent and this allows me to take a picture and get the result back with the help of ActivityResultLauncher.
Now, Is there any way to change the default settings of the default app of Camera by passing some specific parameters for example, image size, etc..?
This is the screen that I get when opening the default camera app, so Is there any way to hide one of the buttons above or at least make it un-clickable?
Solution
Now, Is there any way to change the default settings of the default app of Camera by passing some specific parameters for example, image size, etc..?
First, there is no single "default app of Camera". There are dozens, perhaps hundreds, of default camera apps across the tens of thousands of Android device models. Also, on most older Android versions, ACTION_IMAGE_CAPTURE
can be used to launch the user's own installed camera app.
Second, the only "specific parameters" documented for ACTION_IMAGE_CAPTURE
is EXTRA_OUTPUT
.
This is the screen that I get when opening the default camera app
That is the screen that you get when opening a camera app on a device. There are many, many camera apps that ACTION_IMAGE_CAPTURE
can launch — what you get will depend on the device.
so Is there any way to hide one of the buttons above or at least make it un-clickable?
There is no requirement for a camera app to have those buttons. Or a camera app can have more buttons. FWIW, I own several dozen Android devices, and I do not recall seeing a camera app with that particular UI before.
Answered By - CommonsWare
Answer Checked By - Gilberto Lyons (JavaFixing Admin)