How can I skip an activity created by androids CAMERA_ACTIVITY?

59 Views Asked by At

I'm using androids default camera capture and then a crop library to take a photo then crop it to a square to be displayed on the next layout, the picture stored on the device and a record created on a database.

      Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            camera_intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(image_file));
            startActivityForResult(camera_intent, CAM_REQUEST);

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

 if(requestCode==2 || requestCode == 6709) {
            if (resultCode == RESULT_CANCELED) {
            } else if (resultCode == RESULT_OK) {

                //Crop.pickImage(this);
                if (requestCode == Crop.REQUEST_CROP && resultCode == RESULT_OK) {
                    //doSomethingWithCroppedImage(outputUri);

                    setResult(resultCode);

 } else {
                    File cropme = new File(tempPicture[4]);
                    if (Build.VERSION.SDK_INT >= 24) {
                        try {
                            Method m = StrictMode.class.getMethod("disableDeathOnFileUriExposure");
                            m.invoke(null);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }

                    new Crop(Uri.fromFile(cropme)).output(Uri.fromFile(cropme)).asSquare().start(this);
                }
            }
        }

The problem is there is a picture confirmation page as shown below that's redundant and will save the user a lot of time if I'm able to remove it.

The process from left to right

How can I go about either editing the default camera capture activity or using another camera template online?

I'd like to make process as efficient as possible so if there's a better way of doing this let me know.

1

There are 1 best solutions below

0
On BEST ANSWER

The problem is there is a picture confirmation page as shown below that's redundant and will save the user a lot of time if I'm able to remove it.

Do not use ACTION_IMAGE_CAPTURE. Use the camera APIs directly (e.g., android.hardware.Camera, android.hardware.camera2.*) or via a library that wraps them (e.g., CameraKit-Android, Fotoapparat).

How can I go about either editing the default camera capture activity

There are ~10,000 Android device models. These ship with dozens, if not hundreds, of different camera apps. Plus, users install their own. Any of those can respond to ACTION_IMAGE_CAPTURE. Whether any of them have a confirmation screen is up to the developers of those apps, not you. If you want complete control over the camera experience, do not delegate photo-taking to ACTION_IMAGE_CAPTURE, but write your own camera code.