Android GridView garbage collecting (GC_EXTERNAL_ALLOC) <1K overzealously, causing very choppy UI

前端 未结 3 1332
萌比男神i
萌比男神i 2021-01-31 05:18

I have been looking at this for a long time and finally decided to post - my 2xN GridView, which consists of cells with a single image and piece of text is very choppy a lot of

3条回答
  •  眼角桃花
    2021-01-31 06:02

    Using SimpleCursorAdapter with a custom 2 line ListView layout being used in a ListActivity, no images just text and I have CacheColorHint - #00000000. before I begin I will say that a quick fix is removing cachecolorhint but I need it so it is not a fix to the GC so....

    I have had issues with this same problem now and in the past however this throws a curve ball in it... I have two applications which are essentially mirror images of each other. One will run just fine with no rampant Garbage Collection in the logcat and it scrolls beautifully, The other does not work so well and nothing, no copy and pasting of code can fix it from one to the other.

    ALSO!...Sometimes in the app that is not working so well, I can get it to work when I resort the list from a query and use a slightly different layout for the list view. Don't jump to conclusions though because if I navigate away and come back, the same sorted query using simple cursor adapter on a custom 2 line list item layout will cause the GC again. In other words sometimes it will simply work correctly, and other times it won't. Mind you, I have "scrollingCache" left as the default on both apps and as I said they are copies of each other.

    A while back I encountered this and was able to resolve it somehow and it had nothing to do with ScrollingCache. Rather it had to do with my build compiling against some old version of Android (I think) My memory is not 100% certain of this but I swear the fix was related to a build/compiler issue. I will post something if I remember what fixed it. I use Surround so I am searching for changes. I hope this made sense

提交回复
热议问题