How can I update the Android Gallery after a photo?

For the university i’ve to develop an application on android with the face detections.
For this i’ve to save various photo on my gallery.
The problem is that after saving the photo, the gallery do not update.
More precisely, if I delete the directory where I’m going to save the image, I open the application and shoot the photo, then going into the gallery and after an “update” I see the photo.
But once I have the directory, if I take a new picture, this did not overwrite the old one.