× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

How to download images in android using picasso

Pallav Grover
Dec 13, 2016
<p>Add this in your build.gradle </p> <pre><span style="color:rgb(0, 0, 0)">compile </span><span style="color:rgb(149, 58, 57)">'com.squareup.picasso:picasso:</span><span style="color:rgb(0, 0, 0)">2.5.2</span><span style="color:rgb(149, 58, 57)">'</span> </pre> <p>Many common pitfalls of image loading on Android are handled automatically by Picasso:</p> <ul> <li> <p>Handling <code>ImageView</code> recycling and download cancelation in an adapter.</p> </li> <li> <p>Complex image transformations with minimal memory use.</p> </li> <li> <p>Automatic memory and disk caching.</p> </li> </ul> <p>Now you can just use this single line to download image anywhere in your app .</p> <pre><span style="color:rgb(34, 34, 34)">Picasso</span><span style="color:rgb(136, 136, 136)">.</span>with<span style="color:rgb(136, 136, 136)">(</span><span style="color:rgb(0, 0, 0)">context</span><span style="color:rgb(136, 136, 136)">).</span><span style="color:rgb(0, 0, 0)">load</span><span style="color:rgb(136, 136, 136)">(</span><span style="color:rgb(149, 58, 57)">"http://i.imgur.com/DvpvklR.png"</span><span style="color:rgb(136, 136, 136)">).</span>into<span style="color:rgb(136, 136, 136)">(</span><span style="color:rgb(0, 0, 0)">imageView</span><span style="color:rgb(136, 136, 136)">);</span></pre> <p><span style="color:rgb(136, 136, 136)">Where in load you can give image URL and imageview as your placeholder for image in android</span></p>

Get New Tutorials Delivered to Your Inbox

New tutorials will be sent to your Inbox once a week.

comments powered by Disqus