我无法通过图像的网址找到如何将图像存储到缓存中......有没有办法做到这一点...请帮我这样做...提前谢谢
答案 0 :(得分:0)
您可以通过Web服务调用非常简单地实现位图工厂。
举个例子:
public static Bitmap getBitmapFromURL(String src) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
return myBitmap;
} catch (IOException e) {
// Log exception
return null;
}
}