【发布时间】:2011-03-26 10:06:05
【问题描述】:
我正在尝试从网络中获取图像并将其显示在 imageview 中
我的问题是,如果 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;
【问题讨论】:
标签: android bitmap imageview httpurlconnection