图片下载 也可以 用 AsyncTask 见本人其他博客
private Bitmap getBitmap(String uri) {
InputStream is=null;
try {
URL file=new URL(uri);
HttpURLConnection conn=(HttpURLConnection)file.openConnection();
conn.setConnectTimeout(5000);
conn.getContentLength();
Log.i("文件长度", conn.getContent() + "");
if(conn.getResponseCode()==200){
//返回码 200 代表访问成功
is=conn.getInputStream();
bitmap= BitmapFactory.decodeStream(is);
is.close();
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally {
if(is!=null){