Note that there are some explanatory texts on larger screens.

plurals
  1. POadapter's getView not called after notifyDatasetChanged
    text
    copied!<p>Short Version: The number of datasets in my adapter grows (from initially 4) while loading data. <code>getView</code> is called normally for positions 0 through 3. After new data has arrived (<code>getCount</code> now returns 7), positions 4 trough 6 are queried. Instead I would like to update the first 4 items immediately. </p> <p><strong>My question - how can I make the <code>ListView</code> query <code>getView</code> again for positions 0 through 3 when <code>notifyDataSetChanged</code> is fired?</strong></p> <p>The cause of this behavior may be related to some animations I do with the items in the <code>ListView</code>. My approach is loosely based on <a href="http://graphics-geek.blogspot.ch/2013/06/devbytes-animating-listview-deletion.html" rel="nofollow noreferrer">Chet Haase's example</a> - a <code>DataSetObserver</code> also receives my adapter's <code>onDataSetChange</code> (in addition to the <code>ListView</code>) and launches the animation by adding an <code>onPreDrawListener</code> to the <code>ListView</code>'s <code>ViewTreeObserver</code>. The animation is done in <code>onPreDrawListener</code> (using <code>View.animate</code>) and takes between 300 and 600ms. If I outcomment the line initiating the animation, the behavior is just like I want. <code>getView</code> is called for positions 0, 1, 2, 3 and subsequently 0, 1, 2, 3, 4, 5, 6. </p> <p><img src="https://i.stack.imgur.com/8oWYP.png" alt="LogCat excerpt from illustrating my problem"></p> <p>The following screenshot (left) shows what the list looks like in this undesired state. Compare this with the logcat screenshot - the text on the views matches what comes after "View Text = " in logcat. On the right is what it settles to eventually after the ListView eventually decides to re-query getView for the positions 1-4.</p> <p><img src="https://i.stack.imgur.com/p3zcj.png" alt="screenshots"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload