我们正尝试将一个image下载到Android上,以便在应用程序中查看它。我们可以加载它,但由于内存问题,无法下载。该图像是9MB,但分辨率如此之大我想象这是一个Android的阅读它的问题?将一个巨大的图像下载到Android上(6144x32768)
尝试: 写直SD 毕加索 的OpenStream
URL url = new URL(link);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
和错误:
Java.lang.OutOfMemoryError: Failed to allocate a 805306380 byte allocation with 8329762 free bytes and 180MB until OOM
我们需要实际下载图像,但是。
那么你的问题是什么?无法下载图片?你不知道如何显示一块图像? – Tom
实际从服务器下载图像并对其进行解码时,我们遇到了内存不足问题。我们正在使用BitmapFactory.decodestream –
你能发布相关代码吗? – Tom