3

I have created custom intents for the user to choose photos or take a picture.

Here's my Code:

Intent pickIntent = new Intent(Intent.ACTION_PICK, 
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
pickIntent.setType("image/*");


values = new ContentValues();
values.put(MediaStore.Images.Media.TITLE, "new image");
values.put(MediaStore.Images.Media.DESCRIPTION, "saved today");

Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
cameraPhotoUri = getContentResolver().insert(
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
takePhotoIntent.putExtra(MediaStore.EXTRA_OUTPUT, cameraPhotoUri);



String pickTitle = "Select or take a new Picture"; // Or get from strings.xml
Intent chooserIntent = Intent.createChooser(pickIntent, pickTitle);
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, 
        new Intent[]{takePhotoIntent});

startActivityForResult(chooserIntent, REQUEST_CODE_ADD_PHOTO);

now the getContentResolver().insert(...) part creates an empty file on the image directory.How do I delete all of them (empty files) after using the intents. Please help.

almightyGOSU
  • 3,731
  • 6
  • 31
  • 41
MetaSnarf
  • 5,857
  • 3
  • 25
  • 41

0 Answers0