Solution
The media scanner will eventually sooner or later scan the media card for media and index them. The first intuitive step is to trick the Scanner into not knowing that the file is a media file. This can be achieved by saving the images without the extension. An easy solution would be to append notkevin to the end of the filename. Simply:
Instead of
myRequest.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, Uri.parse(downloadLink).getLastPathSegment());
Use this
String filename = Uri.parse(downloadLink).getLastPathSegment() + "notkevin";
myRequest.setDestinationInExternalFilesDir(this, Environment.DIRECTORY_DOWNLOADS, filename);
However this is not sufficient in your case since you are using the DownloadManager (just a guess). The media scanner somehow knows about the downloaded item and the fact that it is an image and, thus, indexes it. To disallow it, use setMimeType
like this:
myRequest.setMimeType("application/octet-stream");
PS: There are ways to change the extension other than adding your or my name to the end of the filename. For example, you could hash the filename
String filename = hash(Uri.parse(downloadLink).getLastPathSegment());
public String hash(String victim) throws NoSuchAlgorithmException
{
MessageDigest md = MessageDigest.getInstance("SHA1");
md.reset();
byte[] buffer = victim.getBytes();
md.update(buffer);
byte[] digest = md.digest();
StringBuilder hexStr = new StringBuilder();
for (int i = 0; i < digest.length; i++) {
hexStr.append(Integer.toString( ( digest[i] & 0xff ) + 0x100, 16).substring( 1 ));
}
return hexStr.toString();
}