Skip to content

Photo Capture Intent

Roman Tcaregorodtcev edited this page Mar 30, 2018 · 1 revision

Standard Intent action that can be sent to have the camera application capture an image and return it.

OmegaIntentBuilder.from(this)
                .photoCapture()
                .createIntentHandler(this)
                .failCallback(new FailCallback() {
                    @Override
                    public void onActivityStartError(@NotNull Exception exc) {
                        Toast.makeText(PhotoCaptureActivity.this, exc.toString(), Toast.LENGTH_SHORT).show();
                    }
                })
                .startActivityForResult(new ActivityResultCallback() {
                    @Override
                    public void onActivityResult(int resultCode, @NotNull Intent data) {
                        if (resultCode == RESULT_OK) {
                            Bundle extras = data.getExtras();
                            if (extras != null) {
                                Bitmap imageBitmap = (Bitmap) extras.get("data");
                                imageView.setImageBitmap(imageBitmap);
                            }
                        }
                    }
                });

Clone this wiki locally