whenever I clicked on the capture Image button my app is crashes

Viewed 40

Im trying to capture the image and send it to the next activity but whenever im clicking on the capture button my app crashes. here is the code below:

btn_capture.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        //----function call
        captureImage();
    }
});

jpegCallback = new Camera.PictureCallback(){
    @Override
    public void onPictureTaken(byte[] bytes, Camera camera) {
    Intent i = new Intent(getActivity(),ShowCaptureImage.class);
    i.putExtra("capture", bytes);
    startActivity(i);      //<--------- error is occuring here 
    return;
    }
};
return vw;
}
//------------PICTURE TAKEN FUNCTION--------------
private void captureImage() {
camera.takePicture(null,null, jpegCallback);
}
2 Answers

I think the error is happening when you try to get the Intent data in the ShowCaptureImage Activity. Can you post the code for that part?

check on activityresult data and make sure that camera permission is added on manifest file

Related