public static boolean deleteLatestPhoto(){
  try {
    File mediaStorageDir=getMediaStorageDir();
    if (!mediaStorageDir.exists())     return false;
    File[] images=mediaStorageDir.listFiles();
    File latestImage=images[0];
    for (    File image : images) {
      if (image.lastModified() > latestImage.lastModified())       latestImage=image;
    }
    return latestImage.delete();
  }
 catch (  Exception e) {
    Log.e(TAG,"Failed to delete latest image!");
    Log.e(TAG,e.getLocalizedMessage());
    return false;
  }
}

public static boolean deleteLatestPhoto ( ) { try { File mediaStorageDir = getMediaStorageDir ( ) ; if ( ! mediaStorageDir . exists ( ) ) return false ; File [ ] images = mediaStorageDir . listFiles ( ) ; File latestImage = images [ 0 ] ; for ( File image : images ) { if ( image . lastModified ( ) > latestImage . lastModified ( ) ) latestImage = image ; } return latestImage . delete ( ) ; } catch ( Exception e ) { Log . e ( TAG , "Failed to delete latest image!" ) ; Log . e ( TAG , e . getLocalizedMessage ( ) ) ; return false ; } }
deletes the latest photo that placed in the determined directory and returns its result as boolean .
