6

Enhance Your Application Using Picasso

 2 years ago
source link: https://developer.squareup.com/blog/enhance-your-application-using-picasso/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Enhance Your Application Using Picasso
May 14th, 2013 | 1 minute read

Enhance Your Application Using Picasso

A fluent image downloading and caching library for Android.

Twitter
Facebook
Reddit
LinkedIn

Written by D. Koutsogiorgas and Jake Wharton.

Today, we would like to introduce and open source Picasso, our solution for image downloading and caching on Android.

Picasso aims to be fast and simple to use — often requiring only one line of code.

Picasso**.**with**(**context**).**load**(**"http://example.com/logo.png"**).**into**(**imageView**);**

And that’s it! You can use this for downloading a single image or inside of an adapter’s getView method to download many. Picasso automatically handles caching, recycling, and displaying the final bitmap into the target view.

Picasso also allows you to transform images.

Picasso**.**with**(**context**)**
    **.**load**(**"http://example.com/logo.png"**)**
    **.**resize**(**100**,** 100**)**
    **.**centerCrop**()**
    **.**into**(**imageView**);**

The transformation will occur in the same background thread used to decode the original source bitmap and the final result will be stored into memory. This means you can store different transformations of the same source bitmap for future use.

https___cdn-images-1.medium.com_max_2000_0_8HK9zmxeAB0Q79lu.png

Picasso automatically utilizes a memory and disk cache (provided by the HTTP client) to speed up bitmap loading. For development you can enable the display of a colored marker which indicates the image source.

https___cdn-images-1.medium.com_max_2000_0_CLc4oswIfBADUZAk.png

For the latest release of Square Register and future releases of Square Wallet we really wanted to improve image downloading. Picasso is the result of lessons learned from our previous framework as well as various third-party libraries.

More information and downloads are available on the Picasso website.

This post is part of Square’s “Seven Days of Open Source” series. D. Koutsogiorgas Don't settle. Android @Square.medium.com Jake Wharton Stop stopping.medium.com

Picture of Square Engineering

By Square Engineering
@SquareEngMedium


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK