How to delete a photo from the gallery on Android

Asked

Viewed 77 times

1

I have a code where I’m using my camera to take a picture, then I put it in a Imageview, only for viewing as it is saved then in my Sqlite. I wonder, how do I delete this photo from the gallery, since it is already in the database.

This is my code, here I am opening the camera and taking the picture.

private void tirarFoto() {
    Intent it = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

    if (it.resolveActivity(getPackageManager()) != null) {
         startActivityForResult(it, REQUEST_IMAGE_CAPTURE);
    }
}

Here I am taking the image taken and putting in Imageview

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
      Bundle extras = data.getExtras();
      Bitmap imagem = (Bitmap) extras.get("data");
      imgEntrada.setImageBitmap(imagem);
   }
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.