In my app I modify some existing images (like rotating, flipping). While the image is saved correctly, the thumbnails in apps like Google Photos and Gallery still show the old photos. I read that this is because MediaStore still has the old thumbnails which need to be deleted once you modify the file.
I found a Java code to delete thumbnails from MediaStore. Can you please translate the code to B4A so that I can delete the thumbnail by passing it's directory and filename as parameters?
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			I found a Java code to delete thumbnails from MediaStore. Can you please translate the code to B4A so that I can delete the thumbnail by passing it's directory and filename as parameters?
			
				B4X:
			
		
		
		public  void deleteFileFromMediaStore(final ContentResolver contentResolver, final File file) {
    String canonicalPath;
    try {
        canonicalPath = file.getCanonicalPath();
    } catch (IOException e) {
        canonicalPath = file.getAbsolutePath();
    }
    final Uri uri = MediaStore.Files.getContentUri("external");
    final int result = contentResolver.delete(uri,
            MediaStore.Files.FileColumns.DATA + "=?", new String[] {canonicalPath});
    if (result == 0) {
        final String absolutePath = file.getAbsolutePath();
        if (!absolutePath.equals(canonicalPath)) {
            contentResolver.delete(uri,
                    MediaStore.Files.FileColumns.DATA + "=?", new String[]{absolutePath});
        }
    }
} 
				 
 
		 
 
		 
 
		