Reputation: 133
Currently I am using Glide to show images. I have created the custom header(Authorization) for it
public class HeadersClass {
public static GlideUrl getUrlWithHeaders(String url){
return new GlideUrl(url, new LazyHeaders.Builder()
.addHeader("token", "lkajsdlkjasldjasldjaslkdjaslkdj")
.build());
}
}
And using in Glide like this
Glide.with(getActivity())
// .load(baseUrlForImage + urlOfImage)
.load(HeadersClass.getUrlWithHeaders(baseUrlForImage + urlOfImage))
.into(imageView);
And it's working fine but now the issue is the image URL are coming with HTTPS (in starting I was using http only).
With HTTPS now its not showing the image.
Is there any way for it and can I use some other lib for it?
Upvotes: 2
Views: 1049
Reputation: 172
GlideUrl glideUrl = new GlideUrl(**YOUR URL** new LazyHeaders.Builder()
.addHeader("Authorization", **YOUR TOKEN HERE**)
.build());
Glide.with(context)
.load(glideUrl)
.apply(new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(false)
.error(R.drawable.ic_no_pictures **REPLACE THIS WITH UR DRAWABLE**)
.dontAnimate()
.dontTransform())
.into(**IMAGEVIEW**);
Upvotes: 0
Reputation: 245
First you can declare header layout and find image view id and declare activity/fragment
ImageView imageview=findViewById(R.id.imageview);
ViewGroup header = (ViewGroup)inflaterHeader.inflate(R.layout.task_header, listView, false);
listView.addHeaderView(header);
Picasso.get().
load(Url).
into(imageview);
Upvotes: 2