How to check if the URL is an image URL that must be either PNG, GIF, JPG formats
I see that it can be done with this code:
URLConnection connection = new URL("http://foo.bar/w23afv").openConnection();
String contentType = connection.getHeaderField("Content-Type");
boolean image = contentType.startsWith("image/");
But, I need to check using either Glide
or OKHttpClient
.
How to achieve this using two techniques mentioned above?
from Check if the url is image with extension restriction
0 komentar:
Posting Komentar