Here is an easy to use ‘single file based‘ solution:
Adding a file:
Whenever you add a file, inform MediaStore‘s Content Provider using:
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(newMediaFile)));
Deleting a file:
Similarly, when you delete a file, inform MediaStore‘s Content Provider using:
getContentResolver().delete(uri, null, null) // (Credit goes to [DDSports][1])