// 获取指定路径的图片
public static Bitmap getImage(String urlpath)
throws Exception {
URL url = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setConnectTimeout(5 * 1000);
Bitmap bitmap = null;
if (conn.getResponseCode() == 200) {
InputStream inputStream = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(inputStream);
}
return bitmap;
}