class DownloadThread extends AsyncTask<URL,Integer,List<Bitmap>>{
protected List<Bitmap> doInBackground(URL... urls){
InputStream in=null;
try{
List<Bitmap> out=new ArrayList<Bitmap>();
for(int i=0;i<urls.length;i++){
URL url=urls[i];
url = new URL("http://mysite/myimage.png");
in=url.openStream();
Bitmap b=BitmapFactory.decodeStream(in);
out.add(b);
publishProgress(i);
}
return out;
}catch(IOException e){
Log.w("networking","Downloading image failed");
return null;
}
finally{
try {
if(in!=null)in.close();
} catch (IOException e) {
Log.w("networking","Closing stream failed");
}
}
}
}