private Bitmap returnBitmap(URL url) {
// TODO Auto-generated method stub
Bitmap bitmap = null;
try {
URLConnection con = url.openConnection();
con.connect();
InputStream in = con.getInputStream();
bitmap = BitmapFactory.decodeStream(in);
in.close();
Log.d("xutao", "here");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("xutao","wrong!");
}
return bitmap;
}
传入URL,传出bitmap,即可直接赋给imageview。