Note that there are some explanatory texts on larger screens.

plurals
  1. POJerky Scrolling when using SimpleCursorAdapter with ListView
    primarykey
    data
    text
    <p>I'm getting some very jerky scrolling while using the code below to create a ListView from a Cursor. Is there something I'm doing wrong, or any way to improve the performance of this ListView? </p> <pre><code>bookmarksListView = (ListView)findViewById(R.id.bookmarks_listview); bookmarksDbCursor = bookmarkStore.getCursor(); startManagingCursor(bookmarksDbCursor); String[] bookmarksColumns = new String[3]; bookmarksColumns[0] = "TITLE"; bookmarksColumns[1] = "URL"; bookmarksColumns[2] = "ICONID"; int[] bookmarksViews = new int[3]; bookmarksViews[0] = R.id.title_text; bookmarksViews[1] = R.id.subtitle_text; bookmarksViews[2] = R.id.icon_view; bookmarksListAdapter = new SimpleCursorAdapter(this, R.layout.list_item, bookmarksDbCursor, bookmarksColumns, bookmarksViews); bookmarksListView.setAdapter(bookmarksListAdapter); bookmarksListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(BookmarkHistoryTabActivity.this, "Clicked ID " + Long.toString(id), Toast.LENGTH_SHORT).show(); } }); registerForContextMenu(bookmarksListView); </code></pre> <p>Note: <code>bookmarkStore.getCursor()</code> returns an unmanaged cursor from a sqlite database containing the columns from <code>bookmarksColumns</code>.</p> <p>The icons I'm loading (from R.drawable) aren't the issue - I've tried turning them off and it has no effect. I've encountered a similar scrolling issue with a custom ListAdapter extending BaseAdapter I wrote a while ago, and it was caused by not properly setting the view's values in getView() I resolved it using the fix posted at <a href="https://stackoverflow.com/questions/1320478/how-to-load-the-listview-s">How to load the Listview &quot;smoothly&quot; in android</a>..., but that was for a custom adapter class, and I'm not really sure how to implement that fix when I'm using a stock SimpleCursorAdapter, or if that fix even applies to this situation. </p> <p>EDIT: The query returning info on the database looks like this, in case that helps:</p> <pre><code>public Cursor getCursor() { openDB(); Cursor c = mDB.query(DB_TABLENAME, new String[]{"_id", "ICONID", "DATE", "TITLE", "URL"}, null, null, null, null,"DATE DESC"); return c; } </code></pre> <p>EDIT2: I have no idea why, but this behavior only occurs in android 1.6+ I've tried changing my query, removing the sorting, etc. for my cursor, nothing seems to help. The database is very small (&lt;20 items) and only contains the columns present in the query above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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