); if (cameraIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(cameraIntent, REQUEST_PICTURE_CAPTURE); File pictureFile = null; try { pictureFile = getPictureFile(); } catch (IOException ex) { Toast.makeText(this, "Photo file can't be created, please try again", Toast.LENGTH_SHORT).show(); return; } if (pictureFile != null) { Uri photoURI = FileProvider.getUriForFile(this, "com.zoftino.android.fileprovider", pictureFile); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI); startActivityForResult(cameraIntent, REQUEST_PICTURE_CAPTURE); } } 