Note that there are some explanatory texts on larger screens.

plurals
  1. POListView with AlphaIndexer Cache Not Clearing
    text
    copied!<p>So I have one activity with a listview in it that is dynamically updated via cursors. The cursor object is being reused by simply reassigning a query command to this variable, which returns a whole new set of data. This works fine. The issue is that I have extended SimpleCursorAdapter to work with an AlphaIndexer. Apparently when the cursor is updated or changed, its supposed to clear the indexed cache. This is not happening. The main reason for all of this is to have fast scroll working on different cursors that are passed in and have it work. Right now, in using different cursors, the listview is using indexes from the first listview with trying to fastscroll through the second listview.</p> <pre><code>class AlphaCursor extends SimpleCursorAdapter implements SectionIndexer { AlphabetIndexer alphaIndexer; private int list_type; public AlphaCursor(Context context, int layout, Cursor c, String[] from, int[] to, int type, String sortBy) { super(context, layout, c, from, to); // MUST have space in front of alphabet int count = c.getCount(); // this.onContentChanged();doesnt do a thing alphaIndexer = new AlphabetIndexer(c, c.getColumnIndex(sortBy), " ABCDEFGHIJKLMNOPQRSTUVWXYZ"); list_type = type; </code></pre> <p>Any idea what might be going on or how to clear this cache? I tried onChanged() as well as onContentChanged(). Has anyone seen this or know any suggestions?</p> <p>The code is being used like such:</p> <pre><code> alpha = new AlphaCursor(ClassActivity.this, R.layout.list_item, m_cursor, from, to, TAB_HOME, "name"); alpha.changeCursor(m_cursor); mList.setAdapter(alpha); </code></pre> <p>Keep in mind, I have 4 'tabs' that just requery a cursor and create a new AlphaIndexer. Each time a tab is clicked, the alpha variable is nulled out. It looks like there is view cahcing with the indexer.</p> <p>Thanks</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