Hello I am using the Picasso
library to download the images from URL.
URL is using https protocol, here it is not working for me to download the images of https protocol using Picasso
.
Doesn't it support to download the images which uses https protocol, it worked for me only if I use http proctocol ?
Here I am trying to get bitmap which is using https protocol
com.squareup.picasso.Target target = new com.squareup.picasso.Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap, LoadedFrom loadedFrom) {
userProfile.setBitmap(bitmap);
// call the Web API to register the walker here
new AudioStreetAsyncTask(getActivity(), userProfile, getString(R.string.registration_processing_message), new TaskCompleteListener() {
@Override
public void onTaskCompleted(String jsonResponse) {
Log.d(TAG, jsonResponse);
}
});
}
@Override
public void onBitmapFailed(Drawable drawable) {
userProfile.setBitmap(null);
// call the Web API to register the walker here
new AudioStreetAsyncTask(getActivity(), userProfile, getString(R.string.registration_processing_message), new TaskCompleteListener() {
@Override
public void onTaskCompleted(String jsonResponse) {
Log.d(TAG, jsonResponse);
}
}).execute();
}
@Override
public void onPrepareLoad(Drawable drawable) {}
};
Picasso.with(getActivity()).load(imgUrl.toString()).into(target);
Any idea ?
Use those dependencies in your
Gradle
:And this class instead of the original
Picasso
classPicasso class:
Usage example:
Add
@nexus700120 solution is not up to date
@Neha Tyagi solution works but creates multiple instances of
Picasso
in each instance of activity which leaks memorySo I crafted a up to date and singleton solution for redirecting image URLs -
CustomPicasso.java
build.gradle (Module:app)
Usage -
For latest revisions check CustomPicasso gist - https://gist.github.com/hrishikesh-kadam/09cef31c736de088313f1a102f5ed3a3