Search code examples
androidgridviewandroid-volleypicassoandroid-glide

How to load a gridview using volley request and glide/picasso?


I am new to Android, I am trying to populate a gridview from images in the form of bitmaps from a webservice. (I have no control over the webservices). I was able to load the gridview using async task but when I click or cancel the activity/fragment, the async doenst cancel/stop and hence the next activity doesnt open until all the async task is completed.

I had asked a question about this earlier and one of the developer here advice I use Picasso/glide. I am not sure how i use volley to fetch the bitmap and set that to the picasso/glide. Please suggest.


Solution

  • Sorry I can't comment yet. I just want to complete Kelevandos answer by saying that you need to add:

    compile 'com.squareup.picasso:picasso:2.5.2'
    

    in your build.gradle (app), or Maven:

    <dependency>
        <groupId>com.squareup.picasso</groupId>
        <artifactId>picasso</artifactId>
        <version>2.5.2</version>
    </dependency>
    

    to import Picasso. Here is the link to Picasso's main page explaining with more details different function available.