-2
當試圖加載超過20個圖像的OutOfMemoryError通用圖像裝載機
private Bitmap getImage(String url)
{
ImageLoader imageLoader=ImageLoader.getInstance();
bitmap =imageLoader.loadImageSync(url);
return bitmap;
}
11-30 13:12:59.609 11751-12088/com.example.navbartest E/ImageLoader: Failed to allocate a 1464012 byte allocation with 286292 free bytes and 279KB until OOM
java.lang.OutOfMemoryError: Failed to allocate a 1464012 byte allocation with 286292 free bytes and 279KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:634)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:610)
at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:83)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:265)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:223)
at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:136)
at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:297)
at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:209)
at com.nostra13.universalimageloader.core.ImageLoader.loadImage(ImageLoader.java:528)
at com.nostra13.universalimageloader.core.ImageLoader.loadImage(ImageLoader.java:489)
at com.nostra13.universalimageloader.core.ImageLoader.loadImageSync(ImageLoader.java:602)
at com.nostra13.universalimageloader.core.ImageLoader.loadImageSync(ImageLoader.java:543)
at com.example.navbartest.Parsers.InitNews.getImage(InitNews.java:58)
at com.example.navbartest.Parsers.InitNews.<init>(InitNews.java:33)
at com.example.navbartest.Parsers.InitNews.onLoadMore(InitNews.java:101)
at com.example.navbartest.Fragments.MoneyFragment$onLoadMore.doInBackground(MoneyFragment.java:76)
at com.example.navbartest.Fragments.MoneyFragment$onLoadMore.doInBackground(MoneyFragment.java:72)at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)at java.lang.Thread.run(Thread.java:818)
我有同樣的好我得到的OutOfMemoryError幾天前的問題,並通過在清單文件中聲明此語句來解決它們 android:largeHeap =「true」 –