Hi so I have a CursorAdapter which maps to some items inthe database which look like this
gameid|type|picurl|currPlayer|creator
The gameid is a unique id for each game for which I have 2 types. A Player game and a bot game. if the game is a bot game then picurl/currPlayer/creator will be null. Here is my adapter code.
Here is my code: http://pastebin.com/61KZbir1
The problem I am having is that in the initial load sometimes a couple images don't show but when I scroll they do. In addition to this the bot games show the wrong text and image sometimes, but again when i scroll they fix themselves. One thing I did that fixed this was when I am inserting all the data into the table right now I am unregistering the content observer which updates the ui and re-registering it after i am done inserting then calling the method once to update the ui. The method is in the bottom of the pastebin called refreshGamesList(). But when I don't unregister the content observer for the deletes/inserts the view shows incorrectly at first but then it gets more callbacks and it fixes itself with those callbacks. I have looked everywhere for a solution and haven't found anything.
I have fixed it finally! The problem was mainly firing off tasks from my bindview was bad design I think, I moved all the queries I was doing from an asynctask in the bindview to an asynctask in the ui thread (activity) which I then used a matrixcursor and constructed a custom cursor with the data i needed from the other table. I passed the matrixcursor to my adapter and changed having my lazyloader directly manipulating the imageview i was passing to it to just having it call adapter.notiftdatasetchanged() which worked much better. Basically I reworked a lot of the code, because my hunch was that it was firing off a lot of asynctasks from bindview which was screwing everything up so I moved it to the ui thread where it would just be called once and correctly. I think the GC involved in cursor adapter sometimes calls newview/bindview in weird ways and so firing off an asynctask everytime the bindview is called can result in view inconsistencies.