我已经编码为从亚马逊获取图像并在通知的扩展视图中显示。下面是代码
try {
URL url = new URL(imageUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
return BitmapFactory.decodeStream(input);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
相同的代码可以正常工作,并且在某些设备中显示图像,而不是同时在其他设备中显示图像。 未显示图像的异常如下所示
java.net.UnknownHostException: Unable to resolve host
"examples3.s3.amazonaws.com": No address associated with hostname
java.net.ConnectException: Failed to connect to
examples3.s3.amazonaws.com/1.2.3.4:5(some ip showing, this is for the only
reference)