我正在尝试从网络中获取图像并将其显示在imageview
中我的问题是,如果网址是HTTP,我可以获取图片,但如果网址是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;