我們正嘗試將一個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