0

我有一个代码开始意图从相机拍照

Intent pictureActionIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(pictureActionIntent, PhotoUtility.CAMERA_PICTURE);

在图片收回后它应该调用onActivityResult

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != Activity.RESULT_OK)
        return;

    if (requestCode == PhotoUtility.CAMERA_PICTURE) {
        File f = PhotoUtility.saveFromCamera(data, picIV);
        imagePath = f.getAbsolutePath();
    } else if (requestCode == PhotoUtility.GALLERY_PICTURE) {
        File f = PhotoUtility.saveFromGallery(data, getActivity(), picIV);
        imagePath = f.getAbsolutePath();
    }
}

简单的Fragment它工作正常,但如果我使用DialogFragment onActivityResult不是调用。如何解决这个问题DialogFragment

4

0 回答 0