Using Picasso to Show Images in SUSI Android

Important skills of SUSI.AI are to display web search queries, maps of any location and provide a list of relevant information of a topic. This blog post will cover why Glide is replaced by Picasso to show images related to these action types and how it is implemented in SUSI AndroidPicasso is a powerful image downloading and caching open source library developed by Square.

Why Glide is replaced by Picasso to show images in SUSI Android?

Previously we used Glide library to show preview in SUSI Android but we replace it because it was creating an error continuously.

java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity at com.bumptech.glide.manager.RequestManagerRetriever  at Com.bumptech.glide.manager.RequestManagerRetriever.get( at com.bumptech.glide.manager.RequestManagerRetriever.get( com.bumptech.glide.Glide.with(

Reason for this error is when activity destroyed and again recreated the context used by glide is old one and  that activity already destroyed .


One solution of this error is to use context.getApplicationContext()  but it is a bad idea. Another solution is to replace glide by picasso and later one is good because picasso is also a very good image downloading and caching library.

To use Picasso in your project you have to add dependency in build.gradle(Module) file.

dependencies {
  compile “com.squareup.picasso:picasso:2.4.0”

How Picasso is used in different actiontype


“actions”: [
       “type”: “map”,
       “latitude”: “1.2896698812440377”,
       “longitude”: “103.85006683126556”,
       “zoom”: “13”

Link we used to retrieve image url is,longitude& zoom=zoom&size=lengthXbreadth

Picasso will load image from this url and show image in the imageview. Here mapImage is the imageview in which map image is shown.

                       .into(mapImage, new  com.squareup.picasso.Callback() {    
                           public void onSuccess() {
                           public void onError() {
                               Log.d(“Error”, “map image can’t loaded”);


When we query like “Search for fog” we get ‘query’ in reply from server

“query”: “fog”

Now we use this query to retrieve image url which we used in Picasso to show images.Picasso load this image into previewImageView imageview. Image url is retrieved using  DuckDuckGo api. We are using url

It gives a json response which contains image url

      .into(holder.previewImageView, new  com.squareup.picasso.Callback() {
                   public void onSuccess() {
                         Log.d(“Sucess”,“image loaded successfully”);
                   public void onError() {

Here also com.squareup.picasso.Callback is use to find that image is loaded successfully or not.


When we query any like “dhoni” we get ‘link’ in reply from server

“title”: “Dhoni”,

“description”: “”,
“link”: “”

We use this link in android-link-preview library to retrieve relevant image url and then Picasso use this url to load image into imageview previewImageView.