Header Ads

[Android] Picasso Image Loader Library in Android tutorial (super easy)

First of all get to know what is Picasso Image Loader Library.
Picasso is open source and one of the widely used image downloader library in Android. It is created and maintained by Square. It is among the powerful image download and caching library for Android.

but wait.. why to use it, what is special? this is some reason why .

  1. It simplifies the process of loading images from external urls and display on your application. For example, downloading an image from server, is one of the most common task in any application. And it needs quite a larger amount of code to achieve this via android networking API’s. By using Picasso, you can achieve this with few lines of code.
  2. It is always not about downloading image from remote location. You also have to think of implementing image caching logic in order to provide a seamless user experience. Picasso provides automatic image caching.
  3. Image transformation is a costly affair. If your application need deal with such runtime image transformation, you must be watchful about OutOfMemoryException. Picasso deals with it, so you dont have to do it yourself.
So , How To Use Picasso Library In Android?
here is tutorial when i coding  on eclipse .
1: download Download the Picasso JAR file and then just copy the downloaded picasso-2.4.0.jar file into your application lib folder .


2. To using this library.jar you have to config build path on your project.

3.Click add jar.

4.Select library.

5.Move to tab Order and Export and tick on your library.

6.Finish, now you can use that library on your project , now open file xml and add image    view on  layout file to display your image.


7. here is code to load image from url using picasso library. as you can see, it fucking easy :)

Note : don't forget it, you need to add line  below internet permissions to your project’s manifest.
<uses-permission android:name="android.permission.INTERNET" />

Image Resize and Transformation

easy , add this line of code : 
.resize(250, 200)                        // optional        
.rotate(90)                 
Run and this is result . Enjoy

No comments:

Powered by Blogger.