Mohamad Ghaith Alzin
Mohamad Ghaith Alzin

Reputation: 959

Is it possible to change the default configuration of the default Camera app in android?

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..?

enter image description here

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?

Upvotes: 0

Views: 571

Answers (2)

Gokula Krishnan
Gokula Krishnan

Reputation: 329

Unfortunately there is no way you can configure the screen of native android app. We can only pass the URI where the image needs to be saved and size of image.

If you would like to create your own layout, it is possible. You can refer to this repo Open Camera, especially this class AlmalenceGUI which has icon arrangements.

Upvotes: 1

CommonsWare
CommonsWare

Reputation: 1006734

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.

Upvotes: 3

Related Questions