我正在使用ImageLoader并引用this link
我使用了DisplayImages()
和getBitmap()
两种方法,但每次都会出现OutOfMemory
错误。在我阅读的开发者网站上,发现可以使用RecycleImageView
和RecycleBitmapDrawable
类来解决这个问题。
不知道,如何在适配器的getView()
方法中实现它。
使用android:largeHeap="true"
后,logcat显示......
02-27 13:21:00.846: D/OpenGLRenderer(12301): Enabling debug mode 0
02-27 13:21:03.379: D/dalvikvm(12301): GC_CONCURRENT freed 2273K, 18% free 12037K/14580K, paused 2ms+3ms, total 24ms
02-27 13:21:12.028: D/dalvikvm(12301): GC_FOR_ALLOC freed 339K, 14% free 12605K/14580K, paused 29ms, total 36ms
02-27 13:21:13.180: I/dalvikvm-heap(12301): Grow heap (frag case) to 152.441MB for 144636048-byte allocation
02-27 13:21:13.240: D/dalvikvm(12301): GC_CONCURRENT freed 4352K, 5% free 149498K/155828K, paused 14ms+5ms, total 61ms
02-27 13:21:16.003: D/dalvikvm(12301): GC_FOR_ALLOC freed <1K, 5% free 149498K/155828K, paused 17ms, total 18ms
02-27 13:21:16.003: I/dalvikvm-heap(12301): Forcing collection of SoftReferences for 325431088-byte allocation
02-27 13:21:16.043: D/dalvikvm(12301): GC_BEFORE_OOM freed 10K, 5% free 149488K/155828K, paused 37ms, total 37ms
02-27 13:21:16.043: E/dalvikvm-heap(12301): Out of memory on a 325431088-byte allocation.
02-27 13:21:16.043: I/dalvikvm(12301): "main" prio=5 tid=1 RUNNABLE
02-27 13:21:16.043: I/dalvikvm(12301): | group="main" sCount=0 dsCount=0 obj=0x41f7cb50 self=0x41f6c1d0
02-27 13:21:16.043: I/dalvikvm(12301): | sysTid=12301 nice=0 sched=0/0 cgrp=apps handle=1075268828
02-27 13:21:16.043: I/dalvikvm(12301): | state=R schedstat=( 0 0 0 ) utm=296 stm=68 core=0
02-27 13:21:16.043: I/dalvikvm(12301): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
答案 0 :(得分:0)
在旁边应用程序标记的清单文件中使用android:largeHeap =“true”。