I'm trying to capture an image, but after capturing and approving, onActivityResult(int requestCode, int resultCode, Intent data) the data is always null .
This is how I call the camera:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, getImageUri());
startActivityForResult(intent, Consts.ACTION_JOURNEY_CAPTURE_PHOTO_PATH);
Method getImageUri():
private Uri getImageUri() {
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = "IMG_" + timeStamp + "_";
File albumF = helpers.getAlbumDir(getString(R.string.album_name));
File file = new File(albumF, imageFileName);
Uri imgUri = Uri.fromFile(file);
return imgUri;
}
On manifest I have :
<uses-feature android:name="android.hardware.camera" />
What am I doing wrong?
datareturns a thumbnail (very small) image that may be used to give e general idea what the captured image is about. Some devices may not generate thumbnail at all, or only for the main (back) camera. data == null is not an indication of error. - Alex Cohn