I've a list of urls. Each url holds a differenct facebook user's profile pic.
I would like to download these pics and display them on the UI thread (on the screen).
I used new AsyncTask for each image and the images are displayed one by one.
doInBackground (background thread) returns the Bitmap:
InputStream in = new java.net.URL(imgUrl).openStream();
Bitmap bm = BitmapFactory.decodeStream(in);
onPostExecute (UI thread) will set the image bitmap for my members
- Is it the correct way to download the pics or I need to use Handlers?
- AsyncTask is chosen when users want to make changes on the UI while Handler is used to communicate between any 2 threads by messages. Is there any special difference? because it seems that I could use both attitudes.