Adding file path extra to image capture intent causes camera app to malfunction on TF300t Android tablet with stock system version 4.2.1. Pressing "done" button does nothing - not even closing camera app activity. No result is returned.

The code I'm using was extracted from Adroid developers site

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
File imageFile = createImageFile();
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));
startActivityForResult(cameraIntent, THIS_CAMERA_REQUEST);

With createImageFile() defined as:

private File createImageFile() throws IOException {
    File outputDir = getBaseContext().getCacheDir();

    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String imageFileName = "photo_" + timeStamp + "_";
    File image = new File(outputDir, imageFileName);

    return image;
}

When line

cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(imageFile));

is removed, camera app acts as expected.

Is there any resonable workaround ? I would rather not build a camera app myself just to take a photo.

Edit
Report