possible duplicate Stop saving photos using Android native camera
Hello everyone, I am open camera using Intent through like this way
Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, ACTIVITY_CAMERA);
it fine and give me result perfect but, the problem is this will save the image into sdcard also, how to prevent this to stop the saving image and just use that data into the onActivityResult()
method
I am not sure but try it. It might be help you.
onActivityResult i am taking the Image and then going to store it in to the another bitmap.
See this:
if(resultCode == RESULT_OK && requestCode==TAKE_PHOTO_CODE){
final File file = getTempFile(this);
try {
tempBitmap = Media.getBitmap(getContentResolver(), Uri.fromFile(file));
photoBitmap = Bitmap.createScaledBitmap(tempBitmap, display.getWidth(), display.getHeight(), true);
takePhotoFromCamera = true;
// do whatever you want with the bitmap (Resize, Rename, Add To Gallery, etc)
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Now, here you can delete the the file after taking it to the bitmap. So it might be not saved to the sdcard.
Try it. Hope it will help you.
or . . .
Use this:
code to get Last picture taken by user:
String[] projection = new String[]
{MediaStore.Images.ImageColumns._ID, MediaStore.Images.ImageColumns.DATA,
MediaStore.Images.ImageColumns.BUCKET_DISPLAY_NAME,
DATE_TAKEN, MediaStore.Images.ImageColumns.MIME_TYPE};
final Cursor cursor = managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection, null, null, DATE_TAKEN + " DESC");
After getting that image, delete it. So it will help you.
Enjoy. :))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With