I'm developing some kind of android mail app and I get each mail attachments as an ArrayList of urls from a rest api and I want to use them in some kind of attachment section. I need to check the urls and pass image links to a preview adapter using glide api and show other urls (other file formats, like .pdf, .docx or ...) in another section as a download link.
Is there any way to know if the url is link to a image file or not before downloading it?
I know there are seemingly similar threads that are answered already but this is different in two ways. First I want to to know if the url is link to image or not before downloading it. Second I don't want to use static extension check. Because there are like tons of different extensions like .jpg, .png,... and they may change and I don't want to update my app with each change.