How to skip or avoid 'retake and review' option after capturing photo from camera using ACTION_IMAGE_CAPTURE
Asked Answered
M

5

13

I want to display the image when I click on the photo and want to set in my ImageView without user select yes or not....

I had searched for it and I also know it very well that the camera app itself gives you the ability to review/retake the image, and once an image is accepted, the activity displays it. But, I want to do it without review/retake the activity display it.....

I am trying this code fine

Initialise

  Uri mImageCaptureUri;

For Click on Button

  Intent intent      = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    File file        = new File(Environment.getExternalStorageDirectory(),
            "tmp_avatar_" + String.valueOf(System.currentTimeMillis()) + ".jpg");
    mImageCaptureUri = Uri.fromFile(file);

    try {

        intent.putExtra(MediaStore.AUTHORITY, true);
        intent.putExtra("return-data", true);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
        startActivityForResult(intent, PICK_FROM_CAMERA);
    } catch (Exception e) {
        e.printStackTrace();
    }

onActivityResult

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

        Bitmap bitmap = null;


        mPath = mImageCaptureUri.getPath();

        System.out.println("THE PAtH:_" + mPath);

        BitmapFactory.Options o2 = new BitmapFactory.Options();
        bitmap = BitmapFactory.decodeFile(mPath, o2);
        ivSelfie.setImageBitmap(bitmap);

    
}

When I am Click the Photo Than I am Take this screen to select yes or not......

But My requirement is not select review/retake task and direct set to ImageView on activity display when just click and set.....

enter image description here

Millford answered 26/7, 2016 at 4:52 Comment(3)
I don't there is a workthrough for that but instead of using the camera intent, you can use a framelayout and start the camera in your application only. It is easier that way.Hotspur
Yes I know But My requirement to use only inbuilt camera.........Millford
Even in WhatsApp, in previous versions, when they used the stock camera application, even they had the same confirm option after capturing the picture.Hotspur
G
5

Actually it's quite useful to have confirmation of taken picture. But, in case if you really don't want to have it, you have to use SurfaceView inside your app and show camera stream here. There is tones of example how to do it, for example consider to check that one.

Glottochronology answered 26/7, 2016 at 5:13 Comment(3)
Thanks @Glottochronology Sir.... I am Using Oppo Mobile as you know it's a selfie expert so my requirement to do work on it's inbulit camera image......Millford
@Er.Arjunsaini To be honest, don't have an idea what are talking about, but seems it is impossible to comply with your requirementsGlottochronology
Thanks... I am also.... refused to do like that... But I am trying so hard to fulfill my requirementMillford
P
3

Use method setImageURI() it will get the bitmap from the uri and set it for you.

Yes it will set the image weather the user press ok or cancel no matter because your file exists on your given path while launching intent.

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

    if (requestCode == PICK_FROM_CAMERA) {
        // only one line code
        ivSelfie.setImageURI(mImageCaptureUri);
  }   
}
Pachyderm answered 26/7, 2016 at 5:7 Comment(6)
Is it somehow related to question - `When I am Click the Photo Than I am Take this screen to select yes or not......?Glottochronology
Thanks @Sohail Zahid sir For Answer......I am trying this also But I want to avoid the functionality of review/retake.........Millford
@Er.Arjunsaini retake/review is belong to camera app you cant control them camera app interface give us event only on cancel or Ok with result.Pachyderm
@Sohail Zahid..... Thanks.... I am also search about that...But not getting something all are said that you also said that...Millford
@Er.Arjunsaini you are welcome dear something are out of our control so look for other solution.Happy CodingPachyderm
@Sohail Zahid.... I have Some More Idea Can I Review image with Selfie Kit?? click image with selfie Stick and review also with selfie Stick....??Millford
T
2

You cannot avoid that screen. The reason is that when you use new MediaStore.ACTION_IMAGE_CAPTURE you are using a different camera application for clicking image. Showing this screen might be the default functionality of the. This screen will be different in different devices depending upon the camera application.

So to get rid of this the only thing you can do is to implement your custom camera instead of using default camera application.

Tamandua answered 30/7, 2016 at 20:8 Comment(0)
M
1

As per default camera app you can't breach that functionality. Instead of, you can use SurfaceView to capture image inside you application. Please have a look at this answer thread.

May be this link will help you.

Thank you

Mavismavra answered 4/8, 2016 at 13:20 Comment(0)
W
1

Use "android.intent.extra.quickCapture" for your picture intent.

// File ImagePickerModule.java#248
cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra("android.intent.extra.quickCapture",true);

See https://github.com/react-native-community/react-native-image-picker/issues/647 for details.

Waac answered 27/11, 2019 at 11:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.