Sabtu, 16 Maret 2019

Check if the url is image with extension restriction

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

Check if the url is image with extension restriction Rating: 4.5 Diposkan Oleh: Admin

0 komentar:

Posting Komentar

Popular Posts