Search code examples
android-camera-intent

onActivityResult is not calling using camera activity


Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

startActivityForResult(captureIntent, CAMERA_REQUEST);

After taking photo can't call onActivityResult

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

    if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK)
    {
        photo = (Bitmap) data.getExtras().get("data");

        //CALL THIS METHOD TO GET THE URI FROM THE BITMAP
        Uri tempUri = getImageUri(getContext(), photo);
    }
}

Solution

  • I was fixed using this line

    android:configChanges="orientation|screenSize"

    into the AndroidManifest file with related activity.