Why should I download the images via the Picasso library instead of just using this code:
private Bitmap DownloadImage(String URL)
{
Bitmap bitmap = null;
InputStream in = null;
try
{
in = OpenHttpGETConnection(URL);
bitmap = BitmapFactory.decodeStream(in); in.close();
}
catch (Exception e)
{
Log.d("DownloadImage", e.getLocalizedMessage());
}
return bitmap;
}
Another question:
Does Picasso download the image in the UI or by background thread?
Just for the record for anyone new to Android or perhaps moving to Android from iOS ..........
Honestly, it's that simple. The advantages are unbelievable.
It's this easy to use:
Picasso.
with(State.mainContext).
load(parseImageFile.getUrl()).
into(null);
You very simply:
It's that simple. Unless you want to write that from scratch, you simply must use Picasso.
Note that ParseImageFile essentially doesn't work - it is utterly useless about caching and so on. There are admirable alternatives to Picasso (such as Universal Image Loader, check it out), but none work as well as Picasso, for now 2014.
Note if you move to super-advanced-stuffs... The only thing better than Picasso, is to make the move to Volley. but that is a huge leap.
Note that ListView scrolling on android is much, much more problematic than table handling scrolling on iOS. You could say, Android + Picasso is MORE LIKE the situation on iOS, where all the work is already done for scrolling large table views with images.
For today, Picasso is - simply - a central part of any Android app whatsoever. Thank goodness, it is one line of code - no setup, nothing.
Again, the only thing "better than" Picasso is if you move to Volley.
BTW here's an excellent long article on Volley v. Picasso, if you need that...
http://www.bignerdranch.com/blog/solving-the-android-image-loading-problem-volley-vs-picasso/