Is there a way to use the camera, but only temporarily save the image? I'm using the following code to load up the camera, then I'm using onActivityResult() to get the image taken (if any...)
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
the problem is that when the image gets taken, it is saved to the SD card.
EDIT
The intent is called by the following code
String imagePath;
imagePath = Environment.getExternalStorageState() + "/images/myimage.jpg";
File file = new File( imagePath );
Uri outputFileUri = Uri.fromFile( file );
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
When the activity returns data (onActivityResult
) I'm using
File imageFile = new File(imagePath);
imageFile.delete();
Howver the image never gets deleted. Also, if i head into my gallery application, the image is in there was a default name (like image57465.jpg), I'm asuming the cameraIntent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
is not actually working.
EDIT 2
Actually, the file is being saved to the SDCARD, and deleted correctly. However, it seems that the thumbnail is being saved. Ay idea how to get the thumbnail path so i can delete it after i've used it?
Well, can't you just delete the image when you're done using it? I just quick-checked the Camera API-specification, and I couldn't quite find anything that indicates that you can flag an image as temporary.
Try the following:
Let me know if it works out for you.
At the time of capture & saving, store imagepath to the variable and once your activity is done then remove the file(variable) from the storage