Android picasso

Picasso is a really nice library you can use to manage images and specially while loading them. Before using Picasso i have tried to use AsyncTask to load images from a URL, but the performance was very slow and was not functioning the way i wanted my application which was FASTER Loading. 

Now in this tutorial i am going to show you how to load images from URL faster in a grid view where the URL is stored in SQL server database.

You can use any of the databases to fetch the data through select query or JSON and use this library. You can Look at the example given below to know how these images will be loaded.

Here I am loading a Bunch of images while the progress dialog appears at once but it will not affect your application performance.

Now to add picasso to your android project compile this in your app Gradle build file and sync project.

Now to learn how make Sql server connection with your application you can check my post here and get connection class. Now you can paste following code in your resource file. We will first create a GridView.

Now we need to make a custom grid view to add text image or any other thing you would like to add you can add it. Create another resource file item_grid_view.xml.

Now Create a custom adapter for gridview and name it as CustomGridViewItemsActivity. Here i will add code for picasso to fetch images from a URL.

To get elements from Sql query i have created an ItemPojo.

Now go to main activity. here you just have to fire your query and get required detail like URL and title or caption and send it it to the custom adapter and this will handle it all.

Now you can run this code successfully. you have set images from URL in a custom Grid View via Picasso. Same approach can be used for recycler view or list view. If you have any problem you can ask in comment box below. Thank you and Please share and comment if you like this Post.

How useful was this post?

Do not forget to rate! this helps us to Improve.

Average rating / 5. Vote count:

Read More Like This..

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!


Safiya Akhtar

Safiya Akhtar is Android Application Developer in India. She is currently working as a public consultant for career and education too, besides blogging and freelancing. She believes that it is never too late or too early to start what you have always dreamed of.

Your Views And Question are Welcome Here!