1

After capturing the image, the data from the onActivityResult is SOMETIMES null and SOMETIMES not. I did on Oppo a3s. It works fine on other devices like samsung or huawei. The storage is not full.

The permissions are already handle with camera,read & write external storage.

This is the code for starting the camera :

File file = MediaUtil.getPictureFile(mActivity);
mCaptureFilePath = file.getAbsolutePath();
Uri uriSavedImage = FileProvider.getUriForFile(mActivity,mActivity.getPackageName() + ".provider",
                        file);

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
List<ResolveInfo> resolvedIntentActivities = mActivity.getPackageManager()
                        .queryIntentActivities(intent,
                                PackageManager.MATCH_DEFAULT_ONLY);
for (ResolveInfo resolvedIntentInfo : resolvedIntentActivities) {
    String packageName = resolvedIntentInfo.activityInfo.packageName;

    mActivity.grantUriPermission(packageName, uriSavedImage,
                            Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
                                    Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage);
mActivity.startActivityForResult(intent, OPEN_CAMERA);

Error

java.lang.RuntimeException: Unable to resume activity {goldenwesth.ordhub/com.westh.ordhub.ui.activity.AddContributePhotoActivity}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=4, result=-1, data=null} to activity

O.Chounry
  • 304
  • 4
  • 16

0 Answers0