0
我想從網上獲取圖像和ImageView的HttpsURLConnection的創建位圖給出了SSL錯誤
我的問題是我能夠獲取圖像,如果URL是HTTP但如果URL是HTTPS顯示它
我使用下面的代碼: -
Bitmap bitmap = null;
InputStream in = null;
try {
URL url = new URL(URL);
URLConnection conn = url.openConnection();
// HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.connect();
in = conn.getInputStream();
bitmap = BitmapFactory.decodeStream(in);
in.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return bitmap;