public static Bitmap getImage(String address) throws Exception {
Bitmap imgmap = null;
InputStream is = null;
URL url = new URL(address);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
try {
conn.setRequestMethod("GET"); >>> here was been excuted,but go to finally block
conn.setConnectTimeout(5000);
is = conn.getInputStream();
byte[] imgbytes = StreamTool.getBytes(is);
imgmap = BitmapFactory.decodeByteArray(imgbytes, 0, imgbytes.length);
} finally {
if (is != null) {
is.close();
}
if (conn != null) {
conn.disconnect();
}
}
return imgmap;
}
が実行される前conn.setRequestMethod("GET")
に、接続が既に確立されているという例外をスローします。誰が私に解決策を与えることができます