0

I instance of lots of different type of cards which is the subclass of Card. I use a List to collect them.

every time, the listview being instance. I request to server and server responce me json to instance every type of cards. After that I using the CardArrayAdapter to adapter view.

like this :

//init cards from json
List<Card> _cards = getCards(data, getActivity());
adapter.addAll(_cards);

when the listview slide to bottom , I will request again and add to adapter .

but I found that : I can't add unlimited cards to adapter . It appear oom .

I don't know whether it caused by the without RecycleBin to recycle the view or just because build too much card(view) in the memory.(may be i am talking about same things)

so , how can I fix it ?

logcat : it just simple oom log

03-23 11:44:26.383  16371-16557/com.kingnez.umasou.app E/ImageLoader﹕ null
java.lang.OutOfMemoryError
        at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
        at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:620)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:596)
        at com.nostra13.universalimageloader.core.decode.BaseImageDecoder.decode(BaseImageDecoder.java:78)
        at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.decodeImage(LoadAndDisplayImageTask.java:264)
        at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.tryLoadBitmap(LoadAndDisplayImageTask.java:237)
        at com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.run(LoadAndDisplayImageTask.java:135)
        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:841)

0 Answers0